"use strict";

function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

(function (f) {
  if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
    module.exports = f();
  } else if (typeof define === "function" && define.amd) {
    define([], f);
  } else {
    var g;

    if (typeof window !== "undefined") {
      g = window;
    } else if (typeof global !== "undefined") {
      g = global;
    } else if (typeof self !== "undefined") {
      g = self;
    } else {
      g = this;
    }

    g.umd = f();
  }
})(function () {
  var define, module, exports;
  return function () {
    function r(e, n, t) {
      function o(i, f) {
        if (!n[i]) {
          if (!e[i]) {
            var c = "function" == typeof require && require;
            if (!f && c) return c(i, !0);
            if (u) return u(i, !0);
            var a = new Error("Cannot find module '" + i + "'");
            throw a.code = "MODULE_NOT_FOUND", a;
          }

          var p = n[i] = {
            exports: {}
          };
          e[i][0].call(p.exports, function (r) {
            var n = e[i][1][r];
            return o(n || r);
          }, p, p.exports, r, e, n, t);
        }

        return n[i].exports;
      }

      for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
        o(t[i]);
      }

      return o;
    }

    return r;
  }()({
    1: [function (require, module, exports) {
      /*!
       * better-normal-scroll v1.12.6
       * (c) 2019 - chenfenglei  
       * Released under the MIT License.
       */
      (function (global, factory) {
        _typeof(exports) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.BScroll = factory();
      })(this, function () {
        'use strict';

        var slicedToArray = function () {
          function sliceIterator(arr, i) {
            var _arr = [];
            var _n = true;
            var _d = false;
            var _e = undefined;

            try {
              for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
                _arr.push(_s.value);

                if (i && _arr.length === i) break;
              }
            } catch (err) {
              _d = true;
              _e = err;
            } finally {
              try {
                if (!_n && _i["return"]) _i["return"]();
              } finally {
                if (_d) throw _e;
              }
            }

            return _arr;
          }

          return function (arr, i) {
            if (Array.isArray(arr)) {
              return arr;
            } else if (Symbol.iterator in Object(arr)) {
              return sliceIterator(arr, i);
            } else {
              throw new TypeError("Invalid attempt to destructure non-iterable instance");
            }
          };
        }();

        var toConsumableArray = function toConsumableArray(arr) {
          if (Array.isArray(arr)) {
            for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
              arr2[i] = arr[i];
            }

            return arr2;
          } else {
            return Array.from(arr);
          }
        };

        function eventMixin(BScroll) {
          BScroll.prototype.on = function (type, fn) {
            var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this;

            if (!this._events[type]) {
              this._events[type] = [];
            }

            this._events[type].push([fn, context]);
          };

          BScroll.prototype.once = function (type, fn) {
            var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this;

            function magic() {
              this.off(type, magic);
              fn.apply(context, arguments);
            } // To expose the corresponding function method in order to execute the off method


            magic.fn = fn;
            this.on(type, magic);
          };

          BScroll.prototype.off = function (type, fn) {
            var _events = this._events[type];

            if (!_events) {
              return;
            }

            var count = _events.length;

            while (count--) {
              if (_events[count][0] === fn || _events[count][0] && _events[count][0].fn === fn) {
                _events[count][0] = undefined;
              }
            }
          };

          BScroll.prototype.trigger = function (type) {
            var events = this._events[type];

            if (!events) {
              return;
            }

            var len = events.length;
            var eventsCopy = [].concat(toConsumableArray(events));

            for (var i = 0; i < len; i++) {
              var event = eventsCopy[i];

              var _event = slicedToArray(event, 2),
                  fn = _event[0],
                  context = _event[1];

              if (fn) {
                fn.apply(context, [].slice.call(arguments, 1));
              }
            }
          };
        } // ssr support


        var inBrowser = typeof window !== 'undefined';
        var ua = inBrowser && navigator.userAgent.toLowerCase();
        var isWeChatDevTools = ua && /wechatdevtools/.test(ua);
        var isAndroid = ua && ua.indexOf('android') > 0;

        function getNow() {
          return window.performance && window.performance.now ? window.performance.now() + window.performance.timing.navigationStart : +new Date();
        }

        function extend(target) {
          for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            rest[_key - 1] = arguments[_key];
          }

          for (var i = 0; i < rest.length; i++) {
            var source = rest[i];

            for (var key in source) {
              target[key] = source[key];
            }
          }

          return target;
        }

        function isUndef(v) {
          return v === undefined || v === null;
        }

        function getDistance(x, y) {
          return Math.sqrt(x * x + y * y);
        }

        var elementStyle = inBrowser && document.createElement('div').style;

        var vendor = function () {
          if (!inBrowser) {
            return false;
          }

          var transformNames = {
            webkit: 'webkitTransform',
            Moz: 'MozTransform',
            O: 'OTransform',
            ms: 'msTransform',
            standard: 'transform'
          };

          for (var key in transformNames) {
            if (elementStyle[transformNames[key]] !== undefined) {
              return key;
            }
          }

          return false;
        }();

        function prefixStyle(style) {
          if (vendor === false) {
            return false;
          }

          if (vendor === 'standard') {
            if (style === 'transitionEnd') {
              return 'transitionend';
            }

            return style;
          }

          return vendor + style.charAt(0).toUpperCase() + style.substr(1);
        }

        function addEvent(el, type, fn, capture) {
          el.addEventListener(type, fn, {
            passive: false,
            capture: !!capture
          });
        }

        function removeEvent(el, type, fn, capture) {
          el.removeEventListener(type, fn, {
            passive: false,
            capture: !!capture
          });
        }

        function offset(el) {
          var left = 0;
          var top = 0;

          while (el) {
            left -= el.offsetLeft;
            top -= el.offsetTop;
            el = el.offsetParent;
          }

          return {
            left: left,
            top: top
          };
        }

        function offsetToBody(el) {
          var rect = el.getBoundingClientRect();
          return {
            left: -(rect.left + window.pageXOffset),
            top: -(rect.top + window.pageYOffset)
          };
        }

        var transform = prefixStyle('transform');
        var hasPerspective = inBrowser && prefixStyle('perspective') in elementStyle; // fix issue #361

        var hasTouch = inBrowser && ('ontouchstart' in window || isWeChatDevTools);
        var hasTransform = transform !== false;
        var hasTransition = inBrowser && prefixStyle('transition') in elementStyle;
        var style = {
          transform: transform,
          transitionTimingFunction: prefixStyle('transitionTimingFunction'),
          transitionDuration: prefixStyle('transitionDuration'),
          transitionDelay: prefixStyle('transitionDelay'),
          transformOrigin: prefixStyle('transformOrigin'),
          transitionEnd: prefixStyle('transitionEnd')
        };
        var TOUCH_EVENT = 1;
        var MOUSE_EVENT = 2;
        var eventType = {
          touchstart: TOUCH_EVENT,
          touchmove: TOUCH_EVENT,
          touchend: TOUCH_EVENT,
          mousedown: MOUSE_EVENT,
          mousemove: MOUSE_EVENT,
          mouseup: MOUSE_EVENT
        };

        function getRect(el) {
          if (_instanceof(el, window.SVGElement)) {
            var rect = el.getBoundingClientRect();
            return {
              top: rect.top,
              left: rect.left,
              width: rect.width,
              height: rect.height
            };
          } else {
            return {
              top: el.offsetTop,
              left: el.offsetLeft,
              width: el.offsetWidth,
              height: el.offsetHeight
            };
          }
        }

        function preventDefaultException(el, exceptions) {
          for (var i in exceptions) {
            if (exceptions[i].test(el[i])) {
              return true;
            }
          }

          return false;
        }

        function tap(e, eventName) {
          var ev = document.createEvent('Event');
          ev.initEvent(eventName, true, true);
          ev.pageX = e.pageX;
          ev.pageY = e.pageY;
          e.target.dispatchEvent(ev);
        }

        function click(e) {
          var event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'click';
          var eventSource = void 0;

          if (e.type === 'mouseup' || e.type === 'mousecancel') {
            eventSource = e;
          } else if (e.type === 'touchend' || e.type === 'touchcancel') {
            eventSource = e.changedTouches[0];
          }

          var posSrc = {};

          if (eventSource) {
            posSrc.screenX = eventSource.screenX || 0;
            posSrc.screenY = eventSource.screenY || 0;
            posSrc.clientX = eventSource.clientX || 0;
            posSrc.clientY = eventSource.clientY || 0;
          }

          var ev = void 0;
          var bubbles = true;
          var cancelable = true;

          if (typeof MouseEvent !== 'undefined') {
            try {
              ev = new MouseEvent(event, extend({
                bubbles: bubbles,
                cancelable: cancelable
              }, posSrc));
            } catch (e) {
              createEvent();
            }
          } else {
            createEvent();
          }

          function createEvent() {
            ev = document.createEvent('Event');
            ev.initEvent(event, bubbles, cancelable);
            extend(ev, posSrc);
          } // forwardedTouchEvent set to true in case of the conflict with fastclick


          ev.forwardedTouchEvent = true;
          ev._constructed = true;
          e.target.dispatchEvent(ev);
        }

        function dblclick(e) {
          click(e, 'dblclick');
        }

        function prepend(el, target) {
          if (target.firstChild) {
            before(el, target.firstChild);
          } else {
            target.appendChild(el);
          }
        }

        function before(el, target) {
          target.parentNode.insertBefore(el, target);
        }

        function removeChild(el, child) {
          el.removeChild(child);
        }

        var DEFAULT_OPTIONS = {
          startX: 0,
          startY: 0,
          scrollX: false,
          scrollY: true,
          freeScroll: false,
          directionLockThreshold: 5,
          eventPassthrough: '',
          click: false,
          tap: false,

          /**
           * support any side
           * bounce: {
           *   top: true,
           *   bottom: true,
           *   left: true,
           *   right: true
           * }
           */
          bounce: true,
          bounceTime: 800,
          momentum: true,
          momentumLimitTime: 300,
          momentumLimitDistance: 15,
          swipeTime: 2500,
          swipeBounceTime: 500,
          deceleration: 0.0015,
          flickLimitTime: 200,
          flickLimitDistance: 100,
          resizePolling: 60,
          probeType: 0,
          preventDefault: true,
          preventDefaultException: {
            tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/
          },
          HWCompositing: true,
          useTransition: true,
          useTransform: true,
          bindToWrapper: false,
          disableMouse: hasTouch,
          disableTouch: !hasTouch,
          observeDOM: true,
          autoBlur: true,

          /**
           * for picker
           * wheel: {
           *   selectedIndex: 0,
           *   rotate: 25,
           *   adjustTime: 400
           *   wheelWrapperClass: 'wheel-scroll',
           *   wheelItemClass: 'wheel-item'
           * }
           */
          wheel: false,

          /**
           * for slide
           * snap: {
           *   loop: false,
           *   el: domEl,
           *   threshold: 0.1,
           *   stepX: 100,
           *   stepY: 100,
           *   speed: 400,
           *   easing: {
           *     style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
           *     fn: function (t) {
           *       return t * (2 - t)
           *     }
           *   }
           *   listenFlick: true
           * }
           */
          snap: false,

          /**
           * for scrollbar
           * scrollbar: {
           *   fade: true,
           *   interactive: false
           * }
           */
          scrollbar: false,

          /**
           * for pull down and refresh
           * pullDownRefresh: {
           *   threshold: 50,
           *   stop: 20
           * }
           */
          pullDownRefresh: false,

          /**
           * for pull up and load
           * pullUpLoad: {
           *   threshold: 50
           * }
           */
          pullUpLoad: false,

          /**
           * for mouse wheel
           * mouseWheel: {
           *   speed: 20,
           *   invert: false,
           *   easeTime: 300
           * }
           */
          mouseWheel: false,
          stopPropagation: false,

          /**
           * for zoom
           * zoom: {
           *   start: 1,
           *   min: 1,
           *   max: 4
           * }
           */
          zoom: false,

          /**
           * for infinity
           * infinity: {
           *   render(item, div) {
           *   },
           *   createTombstone() {
           *   },
           *   fetch(count) {
           *   }
           * }
           */
          infinity: false,

          /**
           * for double click
           * dblclick: {
           *   delay: 300
           * }
           */
          dblclick: false
        };

        function initMixin(BScroll) {
          BScroll.prototype._init = function (el, options) {
            this._handleOptions(options); // init private custom events


            this._events = {};
            this.x = 0;
            this.y = 0;
            this.directionX = 0;
            this.directionY = 0;
            this.setScale(1);

            this._addDOMEvents();

            this._initExtFeatures();

            this._watchTransition();

            if (this.options.observeDOM) {
              this._initDOMObserver();
            }

            if (this.options.autoBlur) {
              this._handleAutoBlur();
            }

            this.refresh();

            if (!this.options.snap) {
              this.scrollTo(this.options.startX, this.options.startY);
            }

            this.enable();
          };

          BScroll.prototype.setScale = function (scale) {
            this.lastScale = isUndef(this.scale) ? scale : this.scale;
            this.scale = scale;
          };

          BScroll.prototype._handleOptions = function (options) {
            this.options = extend({}, DEFAULT_OPTIONS, options);
            this.translateZ = this.options.HWCompositing && hasPerspective ? ' translateZ(0)' : '';
            this.options.useTransition = this.options.useTransition && hasTransition;
            this.options.useTransform = this.options.useTransform && hasTransform;
            this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault; // If you want eventPassthrough I have to lock one of the axes

            this.options.scrollX = this.options.eventPassthrough === 'horizontal' ? false : this.options.scrollX;
            this.options.scrollY = this.options.eventPassthrough === 'vertical' ? false : this.options.scrollY; // With eventPassthrough we also need lockDirection mechanism

            this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough;
            this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold;

            if (this.options.tap === true) {
              this.options.tap = 'tap';
            }
          };

          BScroll.prototype._addDOMEvents = function () {
            var eventOperation = addEvent;

            this._handleDOMEvents(eventOperation);
          };

          BScroll.prototype._removeDOMEvents = function () {
            var eventOperation = removeEvent;

            this._handleDOMEvents(eventOperation);
          };

          BScroll.prototype._handleDOMEvents = function (eventOperation) {
            var target = this.options.bindToWrapper ? this.wrapper : window;
            eventOperation(window, 'orientationchange', this);
            eventOperation(window, 'resize', this);

            if (this.options.click) {
              eventOperation(this.wrapper, 'click', this, true);
            }

            if (!this.options.disableMouse) {
              eventOperation(this.wrapper, 'mousedown', this);
              eventOperation(target, 'mousemove', this);
              eventOperation(target, 'mousecancel', this);
              eventOperation(target, 'mouseup', this);
            }

            if (hasTouch && !this.options.disableTouch) {
              eventOperation(this.wrapper, 'touchstart', this);
              eventOperation(target, 'touchmove', this);
              eventOperation(target, 'touchcancel', this);
              eventOperation(target, 'touchend', this);
            }

            eventOperation(this.scroller, style.transitionEnd, this);
          };

          BScroll.prototype._initExtFeatures = function () {
            if (this.options.snap) {
              this._initSnap();
            }

            if (this.options.scrollbar) {
              this._initScrollbar();
            }

            if (this.options.pullUpLoad) {
              this._initPullUp();
            }

            if (this.options.pullDownRefresh) {
              this._initPullDown();
            }

            if (this.options.wheel) {
              this._initWheel();
            }

            if (this.options.mouseWheel) {
              this._initMouseWheel();
            }

            if (this.options.zoom) {
              this._initZoom();
            }

            if (this.options.infinity) {
              this._initInfinite();
            }
          };

          BScroll.prototype._watchTransition = function () {
            if (typeof Object.defineProperty !== 'function') {
              return;
            }

            var me = this;
            var isInTransition = false;
            var key = this.useTransition ? 'isInTransition' : 'isAnimating';
            Object.defineProperty(this, key, {
              get: function get() {
                return isInTransition;
              },
              set: function set(newVal) {
                isInTransition = newVal; // fix issue #359

                var el = me.scroller.children.length ? me.scroller.children : [me.scroller];
                var pointerEvents = isInTransition && !me.pulling ? 'none' : 'auto';

                for (var i = 0; i < el.length; i++) {
                  el[i].style.pointerEvents = pointerEvents;
                }
              }
            });
          };

          BScroll.prototype._handleAutoBlur = function () {
            this.on('scrollStart', function () {
              var activeElement = document.activeElement;

              if (activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA')) {
                activeElement.blur();
              }
            });
          };

          BScroll.prototype._initDOMObserver = function () {
            var _this = this;

            if (typeof MutationObserver !== 'undefined') {
              var timer = void 0;
              var observer = new MutationObserver(function (mutations) {
                // don't do any refresh during the transition, or outside of the boundaries
                if (_this._shouldNotRefresh()) {
                  return;
                }

                var immediateRefresh = false;
                var deferredRefresh = false;

                for (var i = 0; i < mutations.length; i++) {
                  var mutation = mutations[i];

                  if (mutation.type !== 'attributes') {
                    immediateRefresh = true;
                    break;
                  } else {
                    if (mutation.target !== _this.scroller) {
                      deferredRefresh = true;
                      break;
                    }
                  }
                }

                if (immediateRefresh) {
                  _this.refresh();
                } else if (deferredRefresh) {
                  // attributes changes too often
                  clearTimeout(timer);
                  timer = setTimeout(function () {
                    if (!_this._shouldNotRefresh()) {
                      _this.refresh();
                    }
                  }, 60);
                }
              });
              var config = {
                attributes: true,
                childList: true,
                subtree: true
              };
              observer.observe(this.scroller, config);
              this.on('destroy', function () {
                observer.disconnect();
              });
            } else {
              this._checkDOMUpdate();
            }
          };

          BScroll.prototype._shouldNotRefresh = function () {
            var outsideBoundaries = this.x > this.minScrollX || this.x < this.maxScrollX || this.y > this.minScrollY || this.y < this.maxScrollY;
            return this.isInTransition || this.stopFromTransition || outsideBoundaries;
          };

          BScroll.prototype._checkDOMUpdate = function () {
            var scrollerRect = getRect(this.scroller);
            var oldWidth = scrollerRect.width;
            var oldHeight = scrollerRect.height;

            function check() {
              if (this.destroyed) {
                return;
              }

              scrollerRect = getRect(this.scroller);
              var newWidth = scrollerRect.width;
              var newHeight = scrollerRect.height;

              if (oldWidth !== newWidth || oldHeight !== newHeight) {
                this.refresh();
              }

              oldWidth = newWidth;
              oldHeight = newHeight;
              next.call(this);
            }

            function next() {
              var _this2 = this;

              setTimeout(function () {
                check.call(_this2);
              }, 1000);
            }

            next.call(this);
          };

          BScroll.prototype.handleEvent = function (e) {
            switch (e.type) {
              case 'touchstart':
              case 'mousedown':
                this._start(e);

                if (this.options.zoom && e.touches && e.touches.length > 1) {
                  this._zoomStart(e);
                }

                break;

              case 'touchmove':
              case 'mousemove':
                if (this.options.zoom && e.touches && e.touches.length > 1) {
                  this._zoom(e);
                } else {
                  this._move(e);
                }

                break;

              case 'touchend':
              case 'mouseup':
              case 'touchcancel':
              case 'mousecancel':
                if (this.scaled) {
                  this._zoomEnd(e);
                } else {
                  this._end(e);
                }

                break;

              case 'orientationchange':
              case 'resize':
                this._resize();

                break;

              case 'transitionend':
              case 'webkitTransitionEnd':
              case 'oTransitionEnd':
              case 'MSTransitionEnd':
                this._transitionEnd(e);

                break;

              case 'click':
                if (this.enabled && !e._constructed) {
                  if (!preventDefaultException(e.target, this.options.preventDefaultException)) {
                    e.preventDefault();
                    e.stopPropagation();
                  }
                }

                break;

              case 'wheel':
              case 'DOMMouseScroll':
              case 'mousewheel':
                this._onMouseWheel(e);

                break;
            }
          };

          BScroll.prototype.refresh = function () {
            var isWrapperStatic = window.getComputedStyle(this.wrapper, null).position === 'static';
            var wrapperRect = getRect(this.wrapper);
            this.wrapperWidth = wrapperRect.width;
            this.wrapperHeight = wrapperRect.height;
            var scrollerRect = getRect(this.scroller);
            this.scrollerWidth = Math.round(scrollerRect.width * this.scale);
            this.scrollerHeight = Math.round(scrollerRect.height * this.scale);
            this.relativeX = scrollerRect.left;
            this.relativeY = scrollerRect.top;

            if (isWrapperStatic) {
              this.relativeX -= wrapperRect.left;
              this.relativeY -= wrapperRect.top;
            }

            this.minScrollX = 0;
            this.minScrollY = 0;
            var wheel = this.options.wheel;

            if (wheel) {
              this.items = this.scroller.children;
              this.options.itemHeight = this.itemHeight = this.items.length ? this.scrollerHeight / this.items.length : 0;

              if (this.selectedIndex === undefined) {
                this.selectedIndex = wheel.selectedIndex || 0;
              }

              this.options.startY = -this.selectedIndex * this.itemHeight;
              this.maxScrollX = 0;
              this.maxScrollY = -this.itemHeight * (this.items.length - 1);
            } else {
              this.maxScrollX = this.wrapperWidth - this.scrollerWidth;

              if (!this.options.infinity) {
                this.maxScrollY = this.wrapperHeight - this.scrollerHeight;
              }

              if (this.maxScrollX < 0) {
                this.maxScrollX -= this.relativeX;
                this.minScrollX = -this.relativeX;
              } else if (this.scale > 1) {
                this.maxScrollX = this.maxScrollX / 2 - this.relativeX;
                this.minScrollX = this.maxScrollX;
              }

              if (this.maxScrollY < 0) {
                this.maxScrollY -= this.relativeY;
                this.minScrollY = -this.relativeY;
              } else if (this.scale > 1) {
                this.maxScrollY = this.maxScrollY / 2 - this.relativeY;
                this.minScrollY = this.maxScrollY;
              }
            }

            this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < this.minScrollX;
            this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < this.minScrollY;

            if (!this.hasHorizontalScroll) {
              this.maxScrollX = this.minScrollX;
              this.scrollerWidth = this.wrapperWidth;
            }

            if (!this.hasVerticalScroll) {
              this.maxScrollY = this.minScrollY;
              this.scrollerHeight = this.wrapperHeight;
            }

            this.endTime = 0;
            this.directionX = 0;
            this.directionY = 0;
            this.wrapperOffset = offset(this.wrapper);
            this.trigger('refresh');
            !this.scaled && this.resetPosition();
          };

          BScroll.prototype.enable = function () {
            this.enabled = true;
          };

          BScroll.prototype.disable = function () {
            this.enabled = false;
          };
        }

        var ease = {
          // easeOutQuint
          swipe: {
            style: 'cubic-bezier(0.23, 1, 0.32, 1)',
            fn: function fn(t) {
              return 1 + --t * t * t * t * t;
            }
          },
          // easeOutQuard
          swipeBounce: {
            style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
            fn: function fn(t) {
              return t * (2 - t);
            }
          },
          // easeOutQuart
          bounce: {
            style: 'cubic-bezier(0.165, 0.84, 0.44, 1)',
            fn: function fn(t) {
              return 1 - --t * t * t * t;
            }
          }
        };

        function momentum(current, start, time, lowerMargin, upperMargin, wrapperSize, options) {
          var distance = current - start;
          var speed = Math.abs(distance) / time;
          var deceleration = options.deceleration,
              itemHeight = options.itemHeight,
              swipeBounceTime = options.swipeBounceTime,
              wheel = options.wheel,
              swipeTime = options.swipeTime;
          var duration = swipeTime;
          var rate = wheel ? 4 : 15;
          var destination = current + speed / deceleration * (distance < 0 ? -1 : 1);

          if (wheel && itemHeight) {
            destination = Math.round(destination / itemHeight) * itemHeight;
          }

          if (destination < lowerMargin) {
            destination = wrapperSize ? Math.max(lowerMargin - wrapperSize / 4, lowerMargin - wrapperSize / rate * speed) : lowerMargin;
            duration = swipeBounceTime;
          } else if (destination > upperMargin) {
            destination = wrapperSize ? Math.min(upperMargin + wrapperSize / 4, upperMargin + wrapperSize / rate * speed) : upperMargin;
            duration = swipeBounceTime;
          }

          return {
            destination: Math.round(destination),
            duration: duration
          };
        }

        var DEFAULT_INTERVAL = 100 / 60;

        function noop() {}

        var requestAnimationFrame = function () {
          if (!inBrowser) {
            /* istanbul ignore if */
            return noop;
          }

          return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || // if all else fails, use setTimeout
          function (callback) {
            return window.setTimeout(callback, (callback.interval || DEFAULT_INTERVAL) / 2); // make interval as precise as possible.
          };
        }();

        var cancelAnimationFrame = function () {
          if (!inBrowser) {
            /* istanbul ignore if */
            return noop;
          }

          return window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame || function (id) {
            window.clearTimeout(id);
          };
        }();

        var DIRECTION_UP = 1;
        var DIRECTION_DOWN = -1;
        var DIRECTION_LEFT = 1;
        var DIRECTION_RIGHT = -1;
        var PROBE_DEBOUNCE = 1;
        var PROBE_REALTIME = 3;

        function warn(msg) {
          console.error('[BScroll warn]: ' + msg);
        }

        function assert(condition, msg) {
          if (!condition) {
            throw new Error('[BScroll] ' + msg);
          }
        }

        function coreMixin(BScroll) {
          BScroll.prototype._start = function (e) {
            var _eventType = eventType[e.type];

            if (_eventType !== TOUCH_EVENT) {
              if (e.button !== 0) {
                return;
              }
            }

            if (!this.enabled || this.destroyed || this.initiated && this.initiated !== _eventType) {
              return;
            }

            this.initiated = _eventType;

            if (this.options.preventDefault && !preventDefaultException(e.target, this.options.preventDefaultException)) {
              e.preventDefault();
            }

            if (this.options.stopPropagation) {
              e.stopPropagation();
            }

            this.moved = false;
            this.distX = 0;
            this.distY = 0;
            this.directionX = 0;
            this.directionY = 0;
            this.movingDirectionX = 0;
            this.movingDirectionY = 0;
            this.directionLocked = 0;

            this._transitionTime();

            this.startTime = getNow();

            if (this.options.wheel) {
              this.target = e.target;
            }

            this.stop();
            var point = e.touches ? e.touches[0] : e;
            this.startX = this.x;
            this.startY = this.y;
            this.absStartX = this.x;
            this.absStartY = this.y;
            this.pointX = point.pageX;
            this.pointY = point.pageY;
            this.trigger('beforeScrollStart');
          };

          BScroll.prototype._move = function (e) {
            if (!this.enabled || this.destroyed || eventType[e.type] !== this.initiated) {
              return;
            }

            if (this.options.preventDefault) {
              e.preventDefault();
            }

            if (this.options.stopPropagation) {
              e.stopPropagation();
            }

            var point = e.touches ? e.touches[0] : e;
            var deltaX = point.pageX - this.pointX;
            var deltaY = point.pageY - this.pointY;
            this.pointX = point.pageX;
            this.pointY = point.pageY;
            this.distX += deltaX;
            this.distY += deltaY;
            var absDistX = Math.abs(this.distX);
            var absDistY = Math.abs(this.distY);
            var timestamp = getNow(); // We need to move at least momentumLimitDistance pixels for the scrolling to initiate

            if (timestamp - this.endTime > this.options.momentumLimitTime && absDistY < this.options.momentumLimitDistance && absDistX < this.options.momentumLimitDistance) {
              return;
            } // If you are scrolling in one direction lock the other


            if (!this.directionLocked && !this.options.freeScroll) {
              if (absDistX > absDistY + this.options.directionLockThreshold) {
                this.directionLocked = 'h'; // lock horizontally
              } else if (absDistY >= absDistX + this.options.directionLockThreshold) {
                this.directionLocked = 'v'; // lock vertically
              } else {
                this.directionLocked = 'n'; // no lock
              }
            }

            if (this.directionLocked === 'h') {
              if (this.options.eventPassthrough === 'vertical') {
                e.preventDefault();
              } else if (this.options.eventPassthrough === 'horizontal') {
                this.initiated = false;
                return;
              }

              deltaY = 0;
            } else if (this.directionLocked === 'v') {
              if (this.options.eventPassthrough === 'horizontal') {
                e.preventDefault();
              } else if (this.options.eventPassthrough === 'vertical') {
                this.initiated = false;
                return;
              }

              deltaX = 0;
            }

            deltaX = this.hasHorizontalScroll ? deltaX : 0;
            deltaY = this.hasVerticalScroll ? deltaY : 0;
            this.movingDirectionX = deltaX > 0 ? DIRECTION_RIGHT : deltaX < 0 ? DIRECTION_LEFT : 0;
            this.movingDirectionY = deltaY > 0 ? DIRECTION_DOWN : deltaY < 0 ? DIRECTION_UP : 0;
            var newX = this.x + deltaX;
            var newY = this.y + deltaY;
            var top = false;
            var bottom = false;
            var left = false;
            var right = false; // Slow down or stop if outside of the boundaries

            var bounce = this.options.bounce;

            if (bounce !== false) {
              top = bounce.top === undefined ? true : bounce.top;
              bottom = bounce.bottom === undefined ? true : bounce.bottom;
              left = bounce.left === undefined ? true : bounce.left;
              right = bounce.right === undefined ? true : bounce.right;
            }

            if (newX > this.minScrollX || newX < this.maxScrollX) {
              if (newX > this.minScrollX && left || newX < this.maxScrollX && right) {
                newX = this.x + deltaX / 3;
              } else {
                newX = newX > this.minScrollX ? this.minScrollX : this.maxScrollX;
              }
            }

            if (newY > this.minScrollY || newY < this.maxScrollY) {
              if (newY > this.minScrollY && top || newY < this.maxScrollY && bottom) {
                newY = this.y + deltaY / 3;
              } else {
                newY = newY > this.minScrollY ? this.minScrollY : this.maxScrollY;
              }
            }

            if (!this.moved) {
              this.moved = true;
              this.trigger('scrollStart');
            }

            this._translate(newX, newY);

            if (timestamp - this.startTime > this.options.momentumLimitTime) {
              this.startTime = timestamp;
              this.startX = this.x;
              this.startY = this.y;

              if (this.options.probeType === PROBE_DEBOUNCE) {
                this.trigger('scroll', {
                  x: this.x,
                  y: this.y
                });
              }
            }

            if (this.options.probeType > PROBE_DEBOUNCE) {
              this.trigger('scroll', {
                x: this.x,
                y: this.y
              });
            }

            var scrollLeft = document.documentElement.scrollLeft || window.pageXOffset || document.body.scrollLeft;
            var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
            var pX = this.pointX - scrollLeft;
            var pY = this.pointY - scrollTop;

            if (pX > document.documentElement.clientWidth - this.options.momentumLimitDistance || pX < this.options.momentumLimitDistance || pY < this.options.momentumLimitDistance || pY > document.documentElement.clientHeight - this.options.momentumLimitDistance) {
              this._end(e);
            }
          };

          BScroll.prototype._end = function (e) {
            if (!this.enabled || this.destroyed || eventType[e.type] !== this.initiated) {
              return;
            }

            this.initiated = false;

            if (this.options.preventDefault && !preventDefaultException(e.target, this.options.preventDefaultException)) {
              e.preventDefault();
            }

            if (this.options.stopPropagation) {
              e.stopPropagation();
            }

            this.trigger('touchEnd', {
              x: this.x,
              y: this.y
            });
            this.isInTransition = false; // ensures that the last position is rounded

            var newX = Math.round(this.x);
            var newY = Math.round(this.y);
            var deltaX = newX - this.absStartX;
            var deltaY = newY - this.absStartY;
            this.directionX = deltaX > 0 ? DIRECTION_RIGHT : deltaX < 0 ? DIRECTION_LEFT : 0;
            this.directionY = deltaY > 0 ? DIRECTION_DOWN : deltaY < 0 ? DIRECTION_UP : 0; // if configure pull down refresh, check it first

            if (this.options.pullDownRefresh && this._checkPullDown()) {
              return;
            } // check if it is a click operation


            if (this._checkClick(e)) {
              this.trigger('scrollCancel');
              return;
            } // reset if we are outside of the boundaries


            if (this.resetPosition(this.options.bounceTime, ease.bounce)) {
              return;
            }

            this._translate(newX, newY);

            this.endTime = getNow();
            var duration = this.endTime - this.startTime;
            var absDistX = Math.abs(newX - this.startX);
            var absDistY = Math.abs(newY - this.startY); // flick

            if (this._events.flick && duration < this.options.flickLimitTime && absDistX < this.options.flickLimitDistance && absDistY < this.options.flickLimitDistance) {
              this.trigger('flick');
              return;
            }

            var time = 0; // start momentum animation if needed

            if (this.options.momentum && duration < this.options.momentumLimitTime && (absDistY > this.options.momentumLimitDistance || absDistX > this.options.momentumLimitDistance)) {
              var top = false;
              var bottom = false;
              var left = false;
              var right = false;
              var bounce = this.options.bounce;

              if (bounce !== false) {
                top = bounce.top === undefined ? true : bounce.top;
                bottom = bounce.bottom === undefined ? true : bounce.bottom;
                left = bounce.left === undefined ? true : bounce.left;
                right = bounce.right === undefined ? true : bounce.right;
              }

              var wrapperWidth = this.directionX === DIRECTION_RIGHT && left || this.directionX === DIRECTION_LEFT && right ? this.wrapperWidth : 0;
              var wrapperHeight = this.directionY === DIRECTION_DOWN && top || this.directionY === DIRECTION_UP && bottom ? this.wrapperHeight : 0;
              var momentumX = this.hasHorizontalScroll ? momentum(this.x, this.startX, duration, this.maxScrollX, this.minScrollX, wrapperWidth, this.options) : {
                destination: newX,
                duration: 0
              };
              var momentumY = this.hasVerticalScroll ? momentum(this.y, this.startY, duration, this.maxScrollY, this.minScrollY, wrapperHeight, this.options) : {
                destination: newY,
                duration: 0
              };
              newX = momentumX.destination;
              newY = momentumY.destination;
              time = Math.max(momentumX.duration, momentumY.duration);
              this.isInTransition = true;
            } else {
              if (this.options.wheel) {
                newY = Math.round(newY / this.itemHeight) * this.itemHeight;
                time = this.options.wheel.adjustTime || 400;
              }
            }

            var easing = ease.swipe;

            if (this.options.snap) {
              var snap = this._nearestSnap(newX, newY);

              this.currentPage = snap;
              time = this.options.snapSpeed || Math.max(Math.max(Math.min(Math.abs(newX - snap.x), 1000), Math.min(Math.abs(newY - snap.y), 1000)), 300);
              newX = snap.x;
              newY = snap.y;
              this.directionX = 0;
              this.directionY = 0;
              easing = this.options.snap.easing || ease.bounce;
            }

            if (newX !== this.x || newY !== this.y) {
              // change easing function when scroller goes out of the boundaries
              if (newX > this.minScrollX || newX < this.maxScrollX || newY > this.minScrollY || newY < this.maxScrollY) {
                easing = ease.swipeBounce;
              }

              this.scrollTo(newX, newY, time, easing);
              return;
            }

            if (this.options.wheel) {
              this.selectedIndex = Math.round(Math.abs(this.y / this.itemHeight));
            }

            this.trigger('scrollEnd', {
              x: this.x,
              y: this.y
            });
          };

          BScroll.prototype._checkClick = function (e) {
            // when in the process of pulling down, it should not prevent click
            var preventClick = this.stopFromTransition && !this.pulling;
            this.stopFromTransition = false; // we scrolled less than 15 pixels

            if (!this.moved) {
              if (this.options.wheel) {
                if (this.target && this.target.classList.contains(this.options.wheel.wheelWrapperClass)) {
                  var index = Math.abs(Math.round(this.y / this.itemHeight));

                  var _offset = Math.round((this.pointY + offsetToBody(this.wrapper).top - this.wrapperHeight / 2) / this.itemHeight);

                  this.target = this.items[index + _offset];
                }

                this.scrollToElement(this.target, this.options.wheel.adjustTime || 400, true, true, ease.swipe);
                return true;
              } else {
                if (!preventClick) {
                  var _dblclick = this.options.dblclick;
                  var dblclickTrigged = false;

                  if (_dblclick && this.lastClickTime) {
                    var _dblclick$delay = _dblclick.delay,
                        delay = _dblclick$delay === undefined ? 300 : _dblclick$delay;

                    if (getNow() - this.lastClickTime < delay) {
                      dblclickTrigged = true;
                      dblclick(e);
                    }
                  }

                  if (this.options.tap) {
                    tap(e, this.options.tap);
                  }

                  if (this.options.click && !preventDefaultException(e.target, this.options.preventDefaultException)) {
                    click(e);
                  }

                  this.lastClickTime = dblclickTrigged ? null : getNow();
                  return true;
                }

                return false;
              }
            }

            return false;
          };

          BScroll.prototype._resize = function () {
            var _this = this;

            if (!this.enabled) {
              return;
            } // fix a scroll problem under Android condition


            if (isAndroid) {
              this.wrapper.scrollTop = 0;
            }

            clearTimeout(this.resizeTimeout);
            this.resizeTimeout = setTimeout(function () {
              _this.refresh();
            }, this.options.resizePolling);
          };

          BScroll.prototype._startProbe = function () {
            cancelAnimationFrame(this.probeTimer);
            this.probeTimer = requestAnimationFrame(probe);
            var me = this;

            function probe() {
              var pos = me.getComputedPosition();
              me.trigger('scroll', pos);

              if (!me.isInTransition) {
                me.trigger('scrollEnd', pos);
                return;
              }

              me.probeTimer = requestAnimationFrame(probe);
            }
          };

          BScroll.prototype._transitionTime = function () {
            var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
            this.scrollerStyle[style.transitionDuration] = time + 'ms';

            if (this.options.wheel) {
              for (var i = 0; i < this.items.length; i++) {
                this.items[i].style[style.transitionDuration] = time + 'ms';
              }
            }

            if (this.indicators) {
              for (var _i = 0; _i < this.indicators.length; _i++) {
                this.indicators[_i].transitionTime(time);
              }
            }
          };

          BScroll.prototype._transitionTimingFunction = function (easing) {
            this.scrollerStyle[style.transitionTimingFunction] = easing;

            if (this.options.wheel) {
              for (var i = 0; i < this.items.length; i++) {
                this.items[i].style[style.transitionTimingFunction] = easing;
              }
            }

            if (this.indicators) {
              for (var _i2 = 0; _i2 < this.indicators.length; _i2++) {
                this.indicators[_i2].transitionTimingFunction(easing);
              }
            }
          };

          BScroll.prototype._transitionEnd = function (e) {
            if (e.target !== this.scroller || !this.isInTransition) {
              return;
            }

            this._transitionTime();

            var needReset = !this.pulling || this.movingDirectionY === DIRECTION_UP;

            if (needReset && !this.resetPosition(this.options.bounceTime, ease.bounce)) {
              this.isInTransition = false;

              if (this.options.probeType !== PROBE_REALTIME) {
                this.trigger('scrollEnd', {
                  x: this.x,
                  y: this.y
                });
              }
            }
          };

          BScroll.prototype._translate = function (x, y, scale) {
            assert(!isUndef(x) && !isUndef(y), 'Translate x or y is null or undefined.');

            if (isUndef(scale)) {
              scale = this.scale;
            }

            if (this.options.useTransform) {
              this.scrollerStyle[style.transform] = 'translate(' + x + 'px,' + y + 'px) scale(' + scale + ')' + this.translateZ;
            } else {
              x = Math.round(x);
              y = Math.round(y);
              this.scrollerStyle.left = x + 'px';
              this.scrollerStyle.top = y + 'px';
            }

            if (this.options.wheel) {
              var _options$wheel$rotate = this.options.wheel.rotate,
                  rotate = _options$wheel$rotate === undefined ? 25 : _options$wheel$rotate;

              for (var i = 0; i < this.items.length; i++) {
                var deg = rotate * (y / this.itemHeight + i);
                this.items[i].style[style.transform] = 'rotateX(' + deg + 'deg)';
              }
            }

            this.x = x;
            this.y = y;
            this.setScale(scale);

            if (this.indicators) {
              for (var _i3 = 0; _i3 < this.indicators.length; _i3++) {
                this.indicators[_i3].updatePosition();
              }
            }
          };

          BScroll.prototype._animate = function (destX, destY, duration, easingFn) {
            var me = this;
            var startX = this.x;
            var startY = this.y;
            var startScale = this.lastScale;
            var destScale = this.scale;
            var startTime = getNow();
            var destTime = startTime + duration;

            function step() {
              var now = getNow();

              if (now >= destTime) {
                me.isAnimating = false;

                me._translate(destX, destY, destScale);

                me.trigger('scroll', {
                  x: me.x,
                  y: me.y
                });

                if (!me.pulling && !me.resetPosition(me.options.bounceTime)) {
                  me.trigger('scrollEnd', {
                    x: me.x,
                    y: me.y
                  });
                }

                return;
              }

              now = (now - startTime) / duration;
              var easing = easingFn(now);
              var newX = (destX - startX) * easing + startX;
              var newY = (destY - startY) * easing + startY;
              var newScale = (destScale - startScale) * easing + startScale;

              me._translate(newX, newY, newScale);

              if (me.isAnimating) {
                me.animateTimer = requestAnimationFrame(step);
              }

              if (me.options.probeType === PROBE_REALTIME) {
                me.trigger('scroll', {
                  x: me.x,
                  y: me.y
                });
              }
            }

            this.isAnimating = true;
            cancelAnimationFrame(this.animateTimer);
            step();
          };

          BScroll.prototype.scrollBy = function (x, y) {
            var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
            var easing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ease.bounce;
            x = this.x + x;
            y = this.y + y;
            this.scrollTo(x, y, time, easing);
          };

          BScroll.prototype.scrollTo = function (x, y) {
            var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
            var easing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ease.bounce;
            this.isInTransition = this.options.useTransition && time > 0 && (x !== this.x || y !== this.y);

            if (!time || this.options.useTransition) {
              this._transitionTimingFunction(easing.style);

              this._transitionTime(time);

              this._translate(x, y);

              if (time && this.options.probeType === PROBE_REALTIME) {
                this._startProbe();
              }

              if (!time && (x !== this.x || y !== this.y)) {
                this.trigger('scroll', {
                  x: x,
                  y: y
                }); // force reflow to put everything in position

                this._reflow = document.body.offsetHeight;

                if (!this.resetPosition(this.options.bounceTime, ease.bounce)) {
                  this.trigger('scrollEnd', {
                    x: x,
                    y: y
                  });
                }
              }

              if (this.options.wheel) {
                if (y > this.minScrollY) {
                  this.selectedIndex = 0;
                } else if (y < this.maxScrollY) {
                  this.selectedIndex = this.items.length - 1;
                } else {
                  this.selectedIndex = Math.round(Math.abs(y / this.itemHeight));
                }
              }
            } else {
              this._animate(x, y, time, easing.fn);
            }
          };

          BScroll.prototype.scrollToElement = function (el, time, offsetX, offsetY, easing) {
            if (!el) {
              return;
            }

            el = el.nodeType ? el : this.scroller.querySelector(el);

            if (this.options.wheel && !el.classList.contains(this.options.wheel.wheelItemClass)) {
              return;
            }

            var pos = offset(el);
            pos.left -= this.wrapperOffset.left;
            pos.top -= this.wrapperOffset.top; // if offsetX/Y are true we center the element to the screen

            if (offsetX === true) {
              offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2);
            }

            if (offsetY === true) {
              offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2);
            }

            pos.left -= offsetX || 0;
            pos.top -= offsetY || 0;
            pos.left = pos.left > this.minScrollX ? this.minScrollX : pos.left < this.maxScrollX ? this.maxScrollX : pos.left;
            pos.top = pos.top > this.minScrollY ? this.minScrollY : pos.top < this.maxScrollY ? this.maxScrollY : pos.top;

            if (this.options.wheel) {
              pos.top = Math.round(pos.top / this.itemHeight) * this.itemHeight;
            }

            this.scrollTo(pos.left, pos.top, time, easing);
          };

          BScroll.prototype.resetPosition = function () {
            var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
            var easeing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ease.bounce;
            var x = this.x;
            var roundX = Math.round(x);

            if (!this.hasHorizontalScroll || roundX > this.minScrollX) {
              x = this.minScrollX;
            } else if (roundX < this.maxScrollX) {
              x = this.maxScrollX;
            }

            var y = this.y;
            var roundY = Math.round(y);

            if (!this.hasVerticalScroll || roundY > this.minScrollY) {
              y = this.minScrollY;
            } else if (roundY < this.maxScrollY) {
              y = this.maxScrollY;
            }

            if (x === this.x && y === this.y) {
              return false;
            }

            this.scrollTo(x, y, time, easeing);
            return true;
          };

          BScroll.prototype.getComputedPosition = function () {
            var matrix = window.getComputedStyle(this.scroller, null);
            var x = void 0;
            var y = void 0;

            if (this.options.useTransform) {
              matrix = matrix[style.transform].split(')')[0].split(', ');
              x = +(matrix[12] || matrix[4]);
              y = +(matrix[13] || matrix[5]);
            } else {
              x = +matrix.left.replace(/[^-\d.]/g, '');
              y = +matrix.top.replace(/[^-\d.]/g, '');
            }

            return {
              x: x,
              y: y
            };
          };

          BScroll.prototype.stop = function () {
            if (this.options.useTransition && this.isInTransition) {
              this.isInTransition = false;
              cancelAnimationFrame(this.probeTimer);
              var pos = this.getComputedPosition();

              this._translate(pos.x, pos.y);

              if (this.options.wheel) {
                this.target = this.items[Math.round(-pos.y / this.itemHeight)];
              } else {
                this.trigger('scrollEnd', {
                  x: this.x,
                  y: this.y
                });
              }

              this.stopFromTransition = true;
            } else if (!this.options.useTransition && this.isAnimating) {
              this.isAnimating = false;
              cancelAnimationFrame(this.animateTimer);
              this.trigger('scrollEnd', {
                x: this.x,
                y: this.y
              });
              this.stopFromTransition = true;
            }
          };

          BScroll.prototype.destroy = function () {
            this.destroyed = true;
            this.trigger('destroy');

            if (this.options.useTransition) {
              cancelAnimationFrame(this.probeTimer);
            } else {
              cancelAnimationFrame(this.animateTimer);
            }

            this._removeDOMEvents(); // remove custom events


            this._events = {};
          };
        }

        function snapMixin(BScroll) {
          BScroll.prototype._initSnap = function () {
            var _this = this;

            this.currentPage = {};
            var snap = this.options.snap;

            if (snap.loop) {
              var children = this.scroller.children;

              if (children.length > 1) {
                prepend(children[children.length - 1].cloneNode(true), this.scroller);
                this.scroller.appendChild(children[1].cloneNode(true));
              } else {
                // Loop does not make any sense if there is only one child.
                snap.loop = false;
              }
            }

            var el = snap.el;

            if (typeof el === 'string') {
              el = this.scroller.querySelectorAll(el);
            }

            this.on('refresh', function () {
              _this.pages = [];

              if (!_this.wrapperWidth || !_this.wrapperHeight || !_this.scrollerWidth || !_this.scrollerHeight) {
                return;
              }

              var stepX = snap.stepX || _this.wrapperWidth;
              var stepY = snap.stepY || _this.wrapperHeight;
              var x = 0;
              var y = void 0;
              var cx = void 0;
              var cy = void 0;
              var i = 0;
              var l = void 0;
              var m = 0;
              var n = void 0;
              var rect = void 0;

              if (!el) {
                cx = Math.round(stepX / 2);
                cy = Math.round(stepY / 2);

                while (x > -_this.scrollerWidth) {
                  _this.pages[i] = [];
                  l = 0;
                  y = 0;

                  while (y > -_this.scrollerHeight) {
                    _this.pages[i][l] = {
                      x: Math.max(x, _this.maxScrollX),
                      y: Math.max(y, _this.maxScrollY),
                      width: stepX,
                      height: stepY,
                      cx: x - cx,
                      cy: y - cy
                    };
                    y -= stepY;
                    l++;
                  }

                  x -= stepX;
                  i++;
                }
              } else {
                l = el.length;
                n = -1;

                for (; i < l; i++) {
                  rect = getRect(el[i]);

                  if (i === 0 || rect.left <= getRect(el[i - 1]).left) {
                    m = 0;
                    n++;
                  }

                  if (!_this.pages[m]) {
                    _this.pages[m] = [];
                  }

                  x = Math.max(-rect.left, _this.maxScrollX);
                  y = Math.max(-rect.top, _this.maxScrollY);
                  cx = x - Math.round(rect.width / 2);
                  cy = y - Math.round(rect.height / 2);
                  _this.pages[m][n] = {
                    x: x,
                    y: y,
                    width: rect.width,
                    height: rect.height,
                    cx: cx,
                    cy: cy
                  };

                  if (x > _this.maxScrollX) {
                    m++;
                  }
                }
              }

              _this._checkSnapLoop();

              var initPageX = snap._loopX ? 1 : 0;
              var initPageY = snap._loopY ? 1 : 0;

              _this._goToPage(_this.currentPage.pageX || initPageX, _this.currentPage.pageY || initPageY, 0); // Update snap threshold if needed.


              var snapThreshold = snap.threshold;

              if (snapThreshold % 1 === 0) {
                _this.snapThresholdX = snapThreshold;
                _this.snapThresholdY = snapThreshold;
              } else {
                _this.snapThresholdX = Math.round(_this.pages[_this.currentPage.pageX][_this.currentPage.pageY].width * snapThreshold);
                _this.snapThresholdY = Math.round(_this.pages[_this.currentPage.pageX][_this.currentPage.pageY].height * snapThreshold);
              }
            });
            this.on('scrollEnd', function () {
              if (snap.loop) {
                if (snap._loopX) {
                  if (_this.currentPage.pageX === 0) {
                    _this._goToPage(_this.pages.length - 2, _this.currentPage.pageY, 0);
                  }

                  if (_this.currentPage.pageX === _this.pages.length - 1) {
                    _this._goToPage(1, _this.currentPage.pageY, 0);
                  }
                } else {
                  if (_this.currentPage.pageY === 0) {
                    _this._goToPage(_this.currentPage.pageX, _this.pages[0].length - 2, 0);
                  }

                  if (_this.currentPage.pageY === _this.pages[0].length - 1) {
                    _this._goToPage(_this.currentPage.pageX, 1, 0);
                  }
                }
              }
            });

            if (snap.listenFlick !== false) {
              this.on('flick', function () {
                var time = snap.speed || Math.max(Math.max(Math.min(Math.abs(_this.x - _this.startX), 1000), Math.min(Math.abs(_this.y - _this.startY), 1000)), 300);

                _this._goToPage(_this.currentPage.pageX + _this.directionX, _this.currentPage.pageY + _this.directionY, time);
              });
            }

            this.on('destroy', function () {
              if (snap.loop) {
                var _children = _this.scroller.children;

                if (_children.length > 2) {
                  removeChild(_this.scroller, _children[_children.length - 1]);
                  removeChild(_this.scroller, _children[0]);
                }
              }
            });
          };

          BScroll.prototype._checkSnapLoop = function () {
            var snap = this.options.snap;

            if (!snap.loop || !this.pages || !this.pages.length) {
              return;
            }

            if (this.pages.length > 1) {
              snap._loopX = true;
            }

            if (this.pages[0] && this.pages[0].length > 1) {
              snap._loopY = true;
            }

            if (snap._loopX && snap._loopY) {
              warn('Loop does not support two direction at the same time.');
            }
          };

          BScroll.prototype._nearestSnap = function (x, y) {
            if (!this.pages.length) {
              return {
                x: 0,
                y: 0,
                pageX: 0,
                pageY: 0
              };
            }

            var i = 0; // Check if we exceeded the snap threshold

            if (Math.abs(x - this.absStartX) <= this.snapThresholdX && Math.abs(y - this.absStartY) <= this.snapThresholdY) {
              return this.currentPage;
            }

            if (x > this.minScrollX) {
              x = this.minScrollX;
            } else if (x < this.maxScrollX) {
              x = this.maxScrollX;
            }

            if (y > this.minScrollY) {
              y = this.minScrollY;
            } else if (y < this.maxScrollY) {
              y = this.maxScrollY;
            }

            var l = this.pages.length;

            for (; i < l; i++) {
              if (x >= this.pages[i][0].cx) {
                x = this.pages[i][0].x;
                break;
              }
            }

            l = this.pages[i].length;
            var m = 0;

            for (; m < l; m++) {
              if (y >= this.pages[0][m].cy) {
                y = this.pages[0][m].y;
                break;
              }
            }

            if (i === this.currentPage.pageX) {
              i += this.directionX;

              if (i < 0) {
                i = 0;
              } else if (i >= this.pages.length) {
                i = this.pages.length - 1;
              }

              x = this.pages[i][0].x;
            }

            if (m === this.currentPage.pageY) {
              m += this.directionY;

              if (m < 0) {
                m = 0;
              } else if (m >= this.pages[0].length) {
                m = this.pages[0].length - 1;
              }

              y = this.pages[0][m].y;
            }

            return {
              x: x,
              y: y,
              pageX: i,
              pageY: m
            };
          };

          BScroll.prototype._goToPage = function (x) {
            var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
            var time = arguments[2];
            var easing = arguments[3];
            var snap = this.options.snap;

            if (!snap || !this.pages || !this.pages.length) {
              return;
            }

            easing = easing || snap.easing || ease.bounce;

            if (x >= this.pages.length) {
              x = this.pages.length - 1;
            } else if (x < 0) {
              x = 0;
            }

            if (!this.pages[x]) {
              return;
            }

            if (y >= this.pages[x].length) {
              y = this.pages[x].length - 1;
            } else if (y < 0) {
              y = 0;
            }

            var posX = this.pages[x][y].x;
            var posY = this.pages[x][y].y;
            time = time === undefined ? snap.speed || Math.max(Math.max(Math.min(Math.abs(posX - this.x), 1000), Math.min(Math.abs(posY - this.y), 1000)), 300) : time;
            this.currentPage = {
              x: posX,
              y: posY,
              pageX: x,
              pageY: y
            };
            this.scrollTo(posX, posY, time, easing);
          };

          BScroll.prototype.goToPage = function (x, y, time, easing) {
            var snap = this.options.snap;

            if (!snap || !this.pages || !this.pages.length) {
              return;
            }

            if (snap.loop) {
              var len = void 0;

              if (snap._loopX) {
                len = this.pages.length - 2;

                if (x >= len) {
                  x = len - 1;
                } else if (x < 0) {
                  x = 0;
                }

                x += 1;
              } else {
                len = this.pages[0].length - 2;

                if (y >= len) {
                  y = len - 1;
                } else if (y < 0) {
                  y = 0;
                }

                y += 1;
              }
            }

            this._goToPage(x, y, time, easing);
          };

          BScroll.prototype.next = function (time, easing) {
            var snap = this.options.snap;

            if (!snap) {
              return;
            }

            var x = this.currentPage.pageX;
            var y = this.currentPage.pageY;
            x++;

            if (x >= this.pages.length && this.hasVerticalScroll) {
              x = 0;
              y++;
            }

            this._goToPage(x, y, time, easing);
          };

          BScroll.prototype.prev = function (time, easing) {
            var snap = this.options.snap;

            if (!snap) {
              return;
            }

            var x = this.currentPage.pageX;
            var y = this.currentPage.pageY;
            x--;

            if (x < 0 && this.hasVerticalScroll) {
              x = 0;
              y--;
            }

            this._goToPage(x, y, time, easing);
          };

          BScroll.prototype.getCurrentPage = function () {
            var snap = this.options.snap;

            if (!snap) {
              return null;
            }

            if (snap.loop) {
              var currentPage = void 0;

              if (snap._loopX) {
                currentPage = extend({}, this.currentPage, {
                  pageX: this.currentPage.pageX - 1
                });
              } else {
                currentPage = extend({}, this.currentPage, {
                  pageY: this.currentPage.pageY - 1
                });
              }

              return currentPage;
            }

            return this.currentPage;
          };
        }

        function wheelMixin(BScroll) {
          BScroll.prototype.wheelTo = function () {
            var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

            if (this.options.wheel) {
              this.y = -index * this.itemHeight;
              this.scrollTo(0, this.y);
            }
          };

          BScroll.prototype.getSelectedIndex = function () {
            return this.options.wheel && this.selectedIndex;
          };

          BScroll.prototype._initWheel = function () {
            var wheel = this.options.wheel;

            if (!wheel.wheelWrapperClass) {
              wheel.wheelWrapperClass = 'wheel-scroll';
            }

            if (!wheel.wheelItemClass) {
              wheel.wheelItemClass = 'wheel-item';
            }

            if (wheel.selectedIndex === undefined) {
              wheel.selectedIndex = 0;
              warn('wheel option selectedIndex is required!');
            }
          };
        }

        var INDICATOR_MIN_LEN = 8;

        function scrollbarMixin(BScroll) {
          BScroll.prototype._initScrollbar = function () {
            var _this = this;

            var _options$scrollbar = this.options.scrollbar,
                _options$scrollbar$fa = _options$scrollbar.fade,
                fade = _options$scrollbar$fa === undefined ? true : _options$scrollbar$fa,
                _options$scrollbar$in = _options$scrollbar.interactive,
                interactive = _options$scrollbar$in === undefined ? false : _options$scrollbar$in;
            this.indicators = [];
            var indicator = void 0;

            if (this.options.scrollX) {
              indicator = {
                el: createScrollbar('horizontal'),
                direction: 'horizontal',
                fade: fade,
                interactive: interactive
              };

              this._insertScrollBar(indicator.el);

              this.indicators.push(new Indicator(this, indicator));
            }

            if (this.options.scrollY) {
              indicator = {
                el: createScrollbar('vertical'),
                direction: 'vertical',
                fade: fade,
                interactive: interactive
              };

              this._insertScrollBar(indicator.el);

              this.indicators.push(new Indicator(this, indicator));
            }

            this.on('refresh', function () {
              for (var i = 0; i < _this.indicators.length; i++) {
                _this.indicators[i].refresh();
              }
            });

            if (fade) {
              this.on('scrollEnd', function () {
                for (var i = 0; i < _this.indicators.length; i++) {
                  _this.indicators[i].fade();
                }
              });
              this.on('scrollCancel', function () {
                for (var i = 0; i < _this.indicators.length; i++) {
                  _this.indicators[i].fade();
                }
              });
              this.on('scrollStart', function () {
                for (var i = 0; i < _this.indicators.length; i++) {
                  _this.indicators[i].fade(true);
                }
              });
              this.on('beforeScrollStart', function () {
                for (var i = 0; i < _this.indicators.length; i++) {
                  _this.indicators[i].fade(true, true);
                }
              });
            }

            this.on('destroy', function () {
              _this._removeScrollBars();
            });
          };

          BScroll.prototype._insertScrollBar = function (scrollbar) {
            this.wrapper.appendChild(scrollbar);
          };

          BScroll.prototype._removeScrollBars = function () {
            for (var i = 0; i < this.indicators.length; i++) {
              this.indicators[i].destroy();
            }
          };
        }

        function createScrollbar(direction) {
          var scrollbar = document.createElement('div');
          var indicator = document.createElement('div');
          scrollbar.style.cssText = 'position:absolute;z-index:9999;pointerEvents:none';
          indicator.style.cssText = 'box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px;';
          indicator.className = 'bscroll-indicator';

          if (direction === 'horizontal') {
            scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0';
            indicator.style.height = '100%';
            scrollbar.className = 'bscroll-horizontal-scrollbar';
          } else {
            scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px';
            indicator.style.width = '100%';
            scrollbar.className = 'bscroll-vertical-scrollbar';
          }

          scrollbar.style.cssText += ';overflow:hidden';
          scrollbar.appendChild(indicator);
          return scrollbar;
        }

        function Indicator(scroller, options) {
          this.wrapper = options.el;
          this.wrapperStyle = this.wrapper.style;
          this.indicator = this.wrapper.children[0];
          this.indicatorStyle = this.indicator.style;
          this.scroller = scroller;
          this.direction = options.direction;

          if (options.fade) {
            this.visible = 0;
            this.wrapperStyle.opacity = '0';
          } else {
            this.visible = 1;
          }

          this.sizeRatioX = 1;
          this.sizeRatioY = 1;
          this.maxPosX = 0;
          this.maxPosY = 0;
          this.x = 0;
          this.y = 0;

          if (options.interactive) {
            this._addDOMEvents();
          }
        }

        Indicator.prototype.handleEvent = function (e) {
          switch (e.type) {
            case 'touchstart':
            case 'mousedown':
              this._start(e);

              break;

            case 'touchmove':
            case 'mousemove':
              this._move(e);

              break;

            case 'touchend':
            case 'mouseup':
            case 'touchcancel':
            case 'mousecancel':
              this._end(e);

              break;
          }
        };

        Indicator.prototype.refresh = function () {
          if (this._shouldShow()) {
            this.transitionTime();

            this._calculate();

            this.updatePosition();
          }
        };

        Indicator.prototype.fade = function (visible, hold) {
          var _this2 = this;

          if (hold && !this.visible) {
            return;
          }

          var time = visible ? 250 : 500;
          visible = visible ? '1' : '0';
          this.wrapperStyle[style.transitionDuration] = time + 'ms';
          clearTimeout(this.fadeTimeout);
          this.fadeTimeout = setTimeout(function () {
            _this2.wrapperStyle.opacity = visible;
            _this2.visible = +visible;
          }, 0);
        };

        Indicator.prototype.updatePosition = function () {
          if (this.direction === 'vertical') {
            var y = Math.round(this.sizeRatioY * this.scroller.y);

            if (y < 0) {
              this.transitionTime(500);
              var height = Math.max(this.indicatorHeight + y * 3, INDICATOR_MIN_LEN);
              this.indicatorStyle.height = height + 'px';
              y = 0;
            } else if (y > this.maxPosY) {
              this.transitionTime(500);

              var _height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, INDICATOR_MIN_LEN);

              this.indicatorStyle.height = _height + 'px';
              y = this.maxPosY + this.indicatorHeight - _height;
            } else {
              this.indicatorStyle.height = this.indicatorHeight + 'px';
            }

            this.y = y;

            if (this.scroller.options.useTransform) {
              this.indicatorStyle[style.transform] = 'translateY(' + y + 'px)' + this.scroller.translateZ;
            } else {
              this.indicatorStyle.top = y + 'px';
            }
          } else {
            var x = Math.round(this.sizeRatioX * this.scroller.x);

            if (x < 0) {
              this.transitionTime(500);
              var width = Math.max(this.indicatorWidth + x * 3, INDICATOR_MIN_LEN);
              this.indicatorStyle.width = width + 'px';
              x = 0;
            } else if (x > this.maxPosX) {
              this.transitionTime(500);

              var _width = Math.max(this.indicatorWidth - (x - this.maxPosX) * 3, INDICATOR_MIN_LEN);

              this.indicatorStyle.width = _width + 'px';
              x = this.maxPosX + this.indicatorWidth - _width;
            } else {
              this.indicatorStyle.width = this.indicatorWidth + 'px';
            }

            this.x = x;

            if (this.scroller.options.useTransform) {
              this.indicatorStyle[style.transform] = 'translateX(' + x + 'px)' + this.scroller.translateZ;
            } else {
              this.indicatorStyle.left = x + 'px';
            }
          }
        };

        Indicator.prototype.transitionTime = function () {
          var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
          this.indicatorStyle[style.transitionDuration] = time + 'ms';
        };

        Indicator.prototype.transitionTimingFunction = function (easing) {
          this.indicatorStyle[style.transitionTimingFunction] = easing;
        };

        Indicator.prototype.destroy = function () {
          this._removeDOMEvents();

          this.wrapper.parentNode.removeChild(this.wrapper);
        };

        Indicator.prototype._start = function (e) {
          var point = e.touches ? e.touches[0] : e;
          e.preventDefault();
          e.stopPropagation();
          this.transitionTime();
          this.initiated = true;
          this.moved = false;
          this.lastPointX = point.pageX;
          this.lastPointY = point.pageY;
          this.startTime = getNow();

          this._handleMoveEvents(addEvent);

          this.scroller.trigger('beforeScrollStart');
        };

        Indicator.prototype._move = function (e) {
          var point = e.touches ? e.touches[0] : e;
          e.preventDefault();
          e.stopPropagation();

          if (!this.moved) {
            this.scroller.trigger('scrollStart');
          }

          this.moved = true;
          var deltaX = point.pageX - this.lastPointX;
          this.lastPointX = point.pageX;
          var deltaY = point.pageY - this.lastPointY;
          this.lastPointY = point.pageY;
          var newX = this.x + deltaX;
          var newY = this.y + deltaY;

          this._pos(newX, newY);
        };

        Indicator.prototype._end = function (e) {
          if (!this.initiated) {
            return;
          }

          this.initiated = false;
          e.preventDefault();
          e.stopPropagation();

          this._handleMoveEvents(removeEvent);

          var snapOption = this.scroller.options.snap;

          if (snapOption) {
            var speed = snapOption.speed,
                _snapOption$easing = snapOption.easing,
                easing = _snapOption$easing === undefined ? ease.bounce : _snapOption$easing;

            var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y);

            var time = speed || Math.max(Math.max(Math.min(Math.abs(this.scroller.x - snap.x), 1000), Math.min(Math.abs(this.scroller.y - snap.y), 1000)), 300);

            if (this.scroller.x !== snap.x || this.scroller.y !== snap.y) {
              this.scroller.directionX = 0;
              this.scroller.directionY = 0;
              this.scroller.currentPage = snap;
              this.scroller.scrollTo(snap.x, snap.y, time, easing);
            }
          }

          if (this.moved) {
            this.scroller.trigger('scrollEnd', {
              x: this.scroller.x,
              y: this.scroller.y
            });
          }
        };

        Indicator.prototype._pos = function (x, y) {
          if (x < 0) {
            x = 0;
          } else if (x > this.maxPosX) {
            x = this.maxPosX;
          }

          if (y < 0) {
            y = 0;
          } else if (y > this.maxPosY) {
            y = this.maxPosY;
          }

          x = Math.round(x / this.sizeRatioX);
          y = Math.round(y / this.sizeRatioY);
          this.scroller.scrollTo(x, y);
          this.scroller.trigger('scroll', {
            x: this.scroller.x,
            y: this.scroller.y
          });
        };

        Indicator.prototype._shouldShow = function () {
          if (this.direction === 'vertical' && this.scroller.hasVerticalScroll || this.direction === 'horizontal' && this.scroller.hasHorizontalScroll) {
            this.wrapper.style.display = '';
            return true;
          }

          this.wrapper.style.display = 'none';
          return false;
        };

        Indicator.prototype._calculate = function () {
          if (this.direction === 'vertical') {
            var wrapperHeight = this.wrapper.clientHeight;
            this.indicatorHeight = Math.max(Math.round(wrapperHeight * wrapperHeight / (this.scroller.scrollerHeight || wrapperHeight || 1)), INDICATOR_MIN_LEN);
            this.indicatorStyle.height = this.indicatorHeight + 'px';
            this.maxPosY = wrapperHeight - this.indicatorHeight;
            this.sizeRatioY = this.maxPosY / this.scroller.maxScrollY;
          } else {
            var wrapperWidth = this.wrapper.clientWidth;
            this.indicatorWidth = Math.max(Math.round(wrapperWidth * wrapperWidth / (this.scroller.scrollerWidth || wrapperWidth || 1)), INDICATOR_MIN_LEN);
            this.indicatorStyle.width = this.indicatorWidth + 'px';
            this.maxPosX = wrapperWidth - this.indicatorWidth;
            this.sizeRatioX = this.maxPosX / this.scroller.maxScrollX;
          }
        };

        Indicator.prototype._addDOMEvents = function () {
          var eventOperation = addEvent;

          this._handleDOMEvents(eventOperation);
        };

        Indicator.prototype._removeDOMEvents = function () {
          var eventOperation = removeEvent;

          this._handleDOMEvents(eventOperation);

          this._handleMoveEvents(eventOperation);
        };

        Indicator.prototype._handleMoveEvents = function (eventOperation) {
          if (!this.scroller.options.disableTouch) {
            eventOperation(window, 'touchmove', this);
          }

          if (!this.scroller.options.disableMouse) {
            eventOperation(window, 'mousemove', this);
          }
        };

        Indicator.prototype._handleDOMEvents = function (eventOperation) {
          if (!this.scroller.options.disableTouch) {
            eventOperation(this.indicator, 'touchstart', this);
            eventOperation(window, 'touchend', this);
          }

          if (!this.scroller.options.disableMouse) {
            eventOperation(this.indicator, 'mousedown', this);
            eventOperation(window, 'mouseup', this);
          }
        };

        function pullDownMixin(BScroll) {
          BScroll.prototype._initPullDown = function () {
            // must watch scroll in real time
            this.options.probeType = PROBE_REALTIME;
          };

          BScroll.prototype._checkPullDown = function () {
            var _options$pullDownRefr = this.options.pullDownRefresh,
                _options$pullDownRefr2 = _options$pullDownRefr.threshold,
                threshold = _options$pullDownRefr2 === undefined ? 90 : _options$pullDownRefr2,
                _options$pullDownRefr3 = _options$pullDownRefr.stop,
                stop = _options$pullDownRefr3 === undefined ? 40 : _options$pullDownRefr3; // check if a real pull down action

            if (this.directionY !== DIRECTION_DOWN || this.y < threshold) {
              return false;
            }

            if (!this.pulling) {
              this.pulling = true;
              this.trigger('pullingDown');
            }

            this.scrollTo(this.x, stop, this.options.bounceTime, ease.bounce);
            return this.pulling;
          };

          BScroll.prototype.finishPullDown = function () {
            this.pulling = false;
            this.resetPosition(this.options.bounceTime, ease.bounce);
          };

          BScroll.prototype.openPullDown = function () {
            var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
            this.options.pullDownRefresh = config;

            this._initPullDown();
          };

          BScroll.prototype.closePullDown = function () {
            this.options.pullDownRefresh = false;
          };
        }

        function pullUpMixin(BScroll) {
          BScroll.prototype._initPullUp = function () {
            // must watch scroll in real time
            this.options.probeType = PROBE_REALTIME;
            this.pullupWatching = false;

            this._watchPullUp();
          };

          BScroll.prototype._watchPullUp = function () {
            if (this.pullupWatching) {
              return;
            }

            this.pullupWatching = true;
            this.on('scroll', this._checkToEnd);
          };

          BScroll.prototype._checkToEnd = function (pos) {
            var _this = this;

            var _options$pullUpLoad$t = this.options.pullUpLoad.threshold,
                threshold = _options$pullUpLoad$t === undefined ? 0 : _options$pullUpLoad$t;

            if (this.movingDirectionY === DIRECTION_UP && pos.y <= this.maxScrollY + threshold) {
              // reset pullupWatching status after scroll end.
              this.once('scrollEnd', function () {
                _this.pullupWatching = false;
              });
              this.trigger('pullingUp');
              this.off('scroll', this._checkToEnd);
            }
          };

          BScroll.prototype.finishPullUp = function () {
            var _this2 = this;

            if (this.pullupWatching) {
              this.once('scrollEnd', function () {
                _this2._watchPullUp();
              });
            } else {
              this._watchPullUp();
            }
          };

          BScroll.prototype.openPullUp = function () {
            var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
            this.options.pullUpLoad = config;

            this._initPullUp();
          };

          BScroll.prototype.closePullUp = function () {
            this.options.pullUpLoad = false;

            if (!this.pullupWatching) {
              return;
            }

            this.pullupWatching = false;
            this.off('scroll', this._checkToEnd);
          };
        }

        function mouseWheelMixin(BScroll) {
          BScroll.prototype._initMouseWheel = function () {
            var _this = this;

            this._handleMouseWheelEvent(addEvent);

            this.on('destroy', function () {
              clearTimeout(_this.mouseWheelTimer);
              clearTimeout(_this.mouseWheelEndTimer);

              _this._handleMouseWheelEvent(removeEvent);
            });
            this.firstWheelOpreation = true;
          };

          BScroll.prototype._handleMouseWheelEvent = function (eventOperation) {
            eventOperation(this.wrapper, 'wheel', this);
            eventOperation(this.wrapper, 'mousewheel', this);
            eventOperation(this.wrapper, 'DOMMouseScroll', this);
          };

          BScroll.prototype._onMouseWheel = function (e) {
            var _this2 = this;

            if (!this.enabled) {
              return;
            }

            e.preventDefault();

            if (this.options.stopPropagation) {
              e.stopPropagation();
            }

            if (this.firstWheelOpreation) {
              this.trigger('scrollStart');
            }

            this.firstWheelOpreation = false;
            var _options$mouseWheel = this.options.mouseWheel,
                _options$mouseWheel$s = _options$mouseWheel.speed,
                speed = _options$mouseWheel$s === undefined ? 20 : _options$mouseWheel$s,
                _options$mouseWheel$i = _options$mouseWheel.invert,
                invert = _options$mouseWheel$i === undefined ? false : _options$mouseWheel$i,
                _options$mouseWheel$e = _options$mouseWheel.easeTime,
                easeTime = _options$mouseWheel$e === undefined ? 300 : _options$mouseWheel$e;
            clearTimeout(this.mouseWheelTimer);
            this.mouseWheelTimer = setTimeout(function () {
              if (!_this2.options.snap && !easeTime) {
                _this2.trigger('scrollEnd', {
                  x: _this2.x,
                  y: _this2.y
                });
              }

              _this2.firstWheelOpreation = true;
            }, 400);
            var wheelDeltaX = void 0;
            var wheelDeltaY = void 0;

            switch (true) {
              case 'deltaX' in e:
                if (e.deltaMode === 1) {
                  wheelDeltaX = -e.deltaX * speed;
                  wheelDeltaY = -e.deltaY * speed;
                } else {
                  wheelDeltaX = -e.deltaX;
                  wheelDeltaY = -e.deltaY;
                }

                break;

              case 'wheelDeltaX' in e:
                wheelDeltaX = e.wheelDeltaX / 120 * speed;
                wheelDeltaY = e.wheelDeltaY / 120 * speed;
                break;

              case 'wheelDelta' in e:
                wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * speed;
                break;

              case 'detail' in e:
                wheelDeltaX = wheelDeltaY = -e.detail / 3 * speed;
                break;

              default:
                return;
            }

            var direction = invert ? -1 : 1;
            wheelDeltaX *= direction;
            wheelDeltaY *= direction;

            if (!this.hasVerticalScroll) {
              wheelDeltaX = wheelDeltaY;
              wheelDeltaY = 0;
            }

            var newX = void 0;
            var newY = void 0;

            if (this.options.snap) {
              newX = this.currentPage.pageX;
              newY = this.currentPage.pageY;

              if (wheelDeltaX > 0) {
                newX--;
              } else if (wheelDeltaX < 0) {
                newX++;
              }

              if (wheelDeltaY > 0) {
                newY--;
              } else if (wheelDeltaY < 0) {
                newY++;
              }

              this._goToPage(newX, newY);

              return;
            }

            newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0);
            newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0);
            this.movingDirectionX = this.directionX = wheelDeltaX > 0 ? -1 : wheelDeltaX < 0 ? 1 : 0;
            this.movingDirectionY = this.directionY = wheelDeltaY > 0 ? -1 : wheelDeltaY < 0 ? 1 : 0;

            if (newX > this.minScrollX) {
              newX = this.minScrollX;
            } else if (newX < this.maxScrollX) {
              newX = this.maxScrollX;
            }

            if (newY > this.minScrollY) {
              newY = this.minScrollY;
            } else if (newY < this.maxScrollY) {
              newY = this.maxScrollY;
            }

            var needTriggerEnd = this.y === newY;
            this.scrollTo(newX, newY, easeTime, ease.swipe);
            this.trigger('scroll', {
              x: this.x,
              y: this.y
            });
            clearTimeout(this.mouseWheelEndTimer);

            if (needTriggerEnd) {
              this.mouseWheelEndTimer = setTimeout(function () {
                _this2.trigger('scrollEnd', {
                  x: _this2.x,
                  y: _this2.y
                });
              }, easeTime);
            }
          };
        }

        function zoomMixin(BScroll) {
          BScroll.prototype._initZoom = function () {
            var _options$zoom = this.options.zoom,
                _options$zoom$start = _options$zoom.start,
                start = _options$zoom$start === undefined ? 1 : _options$zoom$start,
                _options$zoom$min = _options$zoom.min,
                min = _options$zoom$min === undefined ? 1 : _options$zoom$min,
                _options$zoom$max = _options$zoom.max,
                max = _options$zoom$max === undefined ? 4 : _options$zoom$max;
            this.scale = Math.min(Math.max(start, min), max);
            this.setScale(this.scale);
            this.scrollerStyle[style.transformOrigin] = '0 0';
          };

          BScroll.prototype._zoomTo = function (scale, originX, originY, startScale) {
            this.scaled = true;
            var lastScale = scale / (startScale || this.scale);
            this.setScale(scale);
            this.refresh();
            var newX = Math.round(this.startX - (originX - this.relativeX) * (lastScale - 1));
            var newY = Math.round(this.startY - (originY - this.relativeY) * (lastScale - 1));

            if (newX > this.minScrollX) {
              newX = this.minScrollX;
            } else if (newX < this.maxScrollX) {
              newX = this.maxScrollX;
            }

            if (newY > this.minScrollY) {
              newY = this.minScrollY;
            } else if (newY < this.maxScrollY) {
              newY = this.maxScrollY;
            }

            if (this.x !== newX || this.y !== newY) {
              this.scrollTo(newX, newY, this.options.bounceTime);
            }

            this.scaled = false;
          };

          BScroll.prototype.zoomTo = function (scale, x, y) {
            var _offsetToBody = offsetToBody(this.wrapper),
                left = _offsetToBody.left,
                top = _offsetToBody.top;

            var originX = x + left - this.x;
            var originY = y + top - this.y;

            this._zoomTo(scale, originX, originY);
          };

          BScroll.prototype._zoomStart = function (e) {
            var firstFinger = e.touches[0];
            var secondFinger = e.touches[1];
            var deltaX = Math.abs(firstFinger.pageX - secondFinger.pageX);
            var deltaY = Math.abs(firstFinger.pageY - secondFinger.pageY);
            this.startDistance = getDistance(deltaX, deltaY);
            this.startScale = this.scale;

            var _offsetToBody2 = offsetToBody(this.wrapper),
                left = _offsetToBody2.left,
                top = _offsetToBody2.top;

            this.originX = Math.abs(firstFinger.pageX + secondFinger.pageX) / 2 + left - this.x;
            this.originY = Math.abs(firstFinger.pageY + secondFinger.pageY) / 2 + top - this.y;
            this.trigger('zoomStart');
          };

          BScroll.prototype._zoom = function (e) {
            if (!this.enabled || this.destroyed || eventType[e.type] !== this.initiated) {
              return;
            }

            if (this.options.preventDefault) {
              e.preventDefault();
            }

            if (this.options.stopPropagation) {
              e.stopPropagation();
            }

            var firstFinger = e.touches[0];
            var secondFinger = e.touches[1];
            var deltaX = Math.abs(firstFinger.pageX - secondFinger.pageX);
            var deltaY = Math.abs(firstFinger.pageY - secondFinger.pageY);
            var distance = getDistance(deltaX, deltaY);
            var scale = distance / this.startDistance * this.startScale;
            this.scaled = true;
            var _options$zoom2 = this.options.zoom,
                _options$zoom2$min = _options$zoom2.min,
                min = _options$zoom2$min === undefined ? 1 : _options$zoom2$min,
                _options$zoom2$max = _options$zoom2.max,
                max = _options$zoom2$max === undefined ? 4 : _options$zoom2$max;

            if (scale < min) {
              scale = 0.5 * min * Math.pow(2.0, scale / min);
            } else if (scale > max) {
              scale = 2.0 * max * Math.pow(0.5, max / scale);
            }

            var lastScale = scale / this.startScale;
            var x = this.startX - (this.originX - this.relativeX) * (lastScale - 1);
            var y = this.startY - (this.originY - this.relativeY) * (lastScale - 1);
            this.setScale(scale);
            this.scrollTo(x, y, 0);
          };

          BScroll.prototype._zoomEnd = function (e) {
            if (!this.enabled || this.destroyed || eventType[e.type] !== this.initiated) {
              return;
            }

            if (this.options.preventDefault) {
              e.preventDefault();
            }

            if (this.options.stopPropagation) {
              e.stopPropagation();
            }

            this.isInTransition = false;
            this.isAnimating = false;
            this.initiated = 0;
            var _options$zoom3 = this.options.zoom,
                _options$zoom3$min = _options$zoom3.min,
                min = _options$zoom3$min === undefined ? 1 : _options$zoom3$min,
                _options$zoom3$max = _options$zoom3.max,
                max = _options$zoom3$max === undefined ? 4 : _options$zoom3$max;
            var scale = this.scale > max ? max : this.scale < min ? min : this.scale;

            this._zoomTo(scale, this.originX, this.originY, this.startScale);

            this.trigger('zoomEnd');
          };
        } // import { ease } from '../util/ease'
        // Number of items to instantiate beyond current view in the scroll direction.


        var RUNWAY_ITEMS = 30; // Number of items to instantiate beyond current view in the opposite direction.

        var RUNWAY_ITEMS_OPPOSITE = 10; // The animation interval (in ms) for fading in content from tombstones.

        var ANIMATION_DURATION_MS = 200; // The number of pixels of default additional length to allow scrolling to.

        var DEFAULT_SCROLL_RUNWAY = 2000;

        function infiniteMixin(BScroll) {
          BScroll.prototype._initInfinite = function () {
            this.options.probeType = 3;
            this.maxScrollY = -DEFAULT_SCROLL_RUNWAY;
            this.infiniteScroller = new InfiniteScroller(this, this.options.infinity);
          };
        }

        function isTombstoneNode(node) {
          if (node && node.classList) {
            return node.classList.contains('tombstone');
          }
        }

        function InfiniteScroller(scroller, options) {
          var _this = this;

          this.options = options;
          assert(typeof this.options.createTombstone === 'function', 'Infinite scroll need createTombstone Function to create tombstone');
          assert(typeof this.options.fetch === 'function', 'Infinite scroll need fetch Function to fetch new data.');
          assert(typeof this.options.render === 'function', 'Infinite scroll need render Function to render each item.');
          this.firstAttachedItem = 0;
          this.lastAttachedItem = 0;
          this.anchorScrollTop = 0;
          this.anchorItem = {
            index: 0,
            offset: 0
          };
          this.tombstoneHeight = 0;
          this.tombstoneWidth = 0;
          this.tombstones = [];
          this.items = [];
          this.loadedItems = 0;
          this.requestInProgress = false;
          this.hasMore = true;
          this.scroller = scroller;
          this.wrapperEl = this.scroller.wrapper;
          this.scrollerEl = this.scroller.scroller;
          this.scroller.on('scroll', function () {
            _this.onScroll();
          });
          this.scroller.on('resize', function () {
            _this.onResize();
          });
          this.onResize();
        }

        InfiniteScroller.prototype.onScroll = function () {
          var scrollTop = -this.scroller.y;
          var delta = scrollTop - this.anchorScrollTop;

          if (scrollTop === 0) {
            this.anchorItem = {
              index: 0,
              offset: 0
            };
          } else {
            this.anchorItem = this._calculateAnchoredItem(this.anchorItem, delta);
          }

          this.anchorScrollTop = scrollTop;

          var lastScreenItem = this._calculateAnchoredItem(this.anchorItem, this.wrapperEl.offsetHeight);

          var start = this.anchorItem.index;
          var end = lastScreenItem.index;

          if (delta < 0) {
            start -= RUNWAY_ITEMS;
            end += RUNWAY_ITEMS_OPPOSITE;
          } else {
            start -= RUNWAY_ITEMS_OPPOSITE;
            end += RUNWAY_ITEMS;
          }

          this.fill(start, end);
          this.maybeRequestContent();
        };

        InfiniteScroller.prototype.onResize = function () {
          var tombstone = this.options.createTombstone();
          tombstone.style.position = 'absolute';
          this.scrollerEl.appendChild(tombstone);
          tombstone.style.display = '';
          this.tombstoneHeight = tombstone.offsetHeight;
          this.tombstoneWidth = tombstone.offsetWidth;
          this.scrollerEl.removeChild(tombstone);

          for (var i = 0; i < this.items.length; i++) {
            this.items[i].height = this.items[i].width = 0;
          }

          this.onScroll();
        };

        InfiniteScroller.prototype.fill = function (start, end) {
          this.firstAttachedItem = Math.max(0, start);

          if (!this.hasMore) {
            end = Math.min(end, this.items.length);
          }

          this.lastAttachedItem = end;
          this.attachContent();
        };

        InfiniteScroller.prototype.maybeRequestContent = function () {
          var _this2 = this;

          if (this.requestInProgress || !this.hasMore) {
            return;
          }

          var itemsNeeded = this.lastAttachedItem - this.loadedItems;

          if (itemsNeeded <= 0) {
            return;
          }

          this.requestInProgress = true;
          this.options.fetch(itemsNeeded).then(function (items) {
            _this2.requestInProgress = false;

            if (items) {
              _this2.addContent(items);
            } else {
              _this2.hasMore = false;

              var tombstoneLen = _this2._removeTombstones();

              var curPos = 0;

              if (_this2.anchorItem.index <= _this2.items.length) {
                curPos = _this2._fixScrollPosition();

                _this2._setupAnimations({}, curPos);

                _this2.scroller.resetPosition(_this2.scroller.options.bounceTime);
              } else {
                _this2.anchorItem.index -= tombstoneLen;
                curPos = _this2._fixScrollPosition();

                _this2._setupAnimations({}, curPos);

                _this2.scroller.stop();

                _this2.scroller.resetPosition();

                _this2.onScroll();
              }
            }
          });
        };

        InfiniteScroller.prototype.addContent = function (items) {
          for (var i = 0; i < items.length; i++) {
            if (this.items.length <= this.loadedItems) {
              this._addItem();
            }

            this.items[this.loadedItems++].data = items[i];
          }

          this.attachContent();
          this.maybeRequestContent();
        };

        InfiniteScroller.prototype.attachContent = function () {
          var unusedNodes = this._collectUnusedNodes();

          var tombstoneAnimations = this._createDOMNodes(unusedNodes);

          this._cleanupUnusedNodes(unusedNodes);

          this._cacheNodeSize();

          var curPos = this._fixScrollPosition();

          this._setupAnimations(tombstoneAnimations, curPos);
        };

        InfiniteScroller.prototype.resetMore = function () {
          this.hasMore = true;
        };

        InfiniteScroller.prototype._removeTombstones = function () {
          var markIndex = void 0;
          var tombstoneLen = 0;
          var itemLen = this.items.length;

          for (var i = 0; i < itemLen; i++) {
            var currentNode = this.items[i].node;
            var currentData = this.items[i].data;

            if ((!currentNode || isTombstoneNode(currentNode)) && !currentData) {
              if (!markIndex) {
                markIndex = i;
              }

              if (currentNode) {
                this.scrollerEl.removeChild(currentNode);
              }
            }
          }

          tombstoneLen = itemLen - markIndex;
          this.items.splice(markIndex);
          this.lastAttachedItem = Math.min(this.lastAttachedItem, this.items.length);
          return tombstoneLen;
        };

        InfiniteScroller.prototype._collectUnusedNodes = function () {
          var unusedNodes = [];

          for (var i = 0; i < this.items.length; i++) {
            // Skip the items which should be visible.
            if (i === this.firstAttachedItem) {
              i = this.lastAttachedItem - 1;
              continue;
            }

            var currentNode = this.items[i].node;

            if (currentNode) {
              if (isTombstoneNode(currentNode)) {
                // Cache tombstones for reuse
                this.tombstones.push(currentNode);
                this.tombstones[this.tombstones.length - 1].style.display = 'none';
              } else {
                unusedNodes.push(currentNode);
              }
            }

            this.items[i].node = null;
          }

          return unusedNodes;
        };

        InfiniteScroller.prototype._createDOMNodes = function (unusedNodes) {
          var tombstoneAnimations = {};

          for (var i = this.firstAttachedItem; i < this.lastAttachedItem; i++) {
            while (this.items.length <= i) {
              this._addItem();
            }

            var currentNode = this.items[i].node;
            var currentData = this.items[i].data;

            if (currentNode) {
              if (isTombstoneNode(currentNode) && currentData) {
                currentNode.style.zIndex = 1;
                tombstoneAnimations[i] = [currentNode, this.items[i].top - this.anchorScrollTop];
                this.items[i].node = null;
              } else {
                continue;
              }
            }

            var node = currentData ? this.options.render(currentData, unusedNodes.pop()) : this._getTombStone();
            node.style.position = 'absolute';
            this.items[i].top = -1;
            this.scrollerEl.appendChild(node);
            this.items[i].node = node;
          }

          return tombstoneAnimations;
        };

        InfiniteScroller.prototype._cleanupUnusedNodes = function (unusedNodes) {
          while (unusedNodes.length) {
            this.scrollerEl.removeChild(unusedNodes.pop());
          }
        };

        InfiniteScroller.prototype._cacheNodeSize = function () {
          for (var i = this.firstAttachedItem; i < this.lastAttachedItem; i++) {
            // Only cache the height if we have the real contents, not a placeholder.
            if (this.items[i].data && !this.items[i].height) {
              this.items[i].height = this.items[i].node.offsetHeight;
              this.items[i].width = this.items[i].node.offsetWidth;
            }
          }
        };

        InfiniteScroller.prototype._fixScrollPosition = function () {
          this.anchorScrollTop = 0;

          for (var _i = 0; _i < this.anchorItem.index; _i++) {
            this.anchorScrollTop += this.items[_i].height || this.tombstoneHeight;
          }

          this.anchorScrollTop += this.anchorItem.offset; // Position all nodes.

          var curPos = this.anchorScrollTop - this.anchorItem.offset;
          var i = this.anchorItem.index;

          while (i > this.firstAttachedItem) {
            curPos -= this.items[i - 1].height || this.tombstoneHeight;
            i--;
          }

          return curPos;
        };

        InfiniteScroller.prototype._setupAnimations = function (tombstoneAnimations, curPos) {
          var _this3 = this;

          for (var i in tombstoneAnimations) {
            var animation = tombstoneAnimations[i];
            this.items[i].node.style.transform = 'translateY(' + (this.anchorScrollTop + animation[1]) + 'px) scale(' + this.tombstoneWidth / this.items[i].width + ', ' + this.tombstoneHeight / this.items[i].height + ')'; // Call offsetTop on the nodes to be animated to force them to apply current transforms.

            /* eslint-disable no-unused-expressions */

            this.items[i].node.offsetTop;
            animation[0].offsetTop;
            this.items[i].node.style.transition = 'transform ' + ANIMATION_DURATION_MS + 'ms';
          }

          for (var _i2 = this.firstAttachedItem; _i2 < this.lastAttachedItem; _i2++) {
            var _animation = tombstoneAnimations[_i2];

            if (_animation) {
              var tombstoneNode = _animation[0];
              tombstoneNode.style.transition = 'transform ' + ANIMATION_DURATION_MS + 'ms, opacity ' + ANIMATION_DURATION_MS + 'ms';
              tombstoneNode.style.transform = 'translateY(' + curPos + 'px) scale(' + this.items[_i2].width / this.tombstoneWidth + ', ' + this.items[_i2].height / this.tombstoneHeight + ')';
              tombstoneNode.style.opacity = 0;
            }

            if (curPos !== this.items[_i2].top) {
              if (!_animation) {
                this.items[_i2].node.style.transition = '';
              }

              this.items[_i2].node.style.transform = 'translateY(' + curPos + 'px)';
            }

            this.items[_i2].top = curPos;
            curPos += this.items[_i2].height || this.tombstoneHeight;
          }

          this.scroller.maxScrollY = -(curPos - this.wrapperEl.offsetHeight + (this.hasMore ? DEFAULT_SCROLL_RUNWAY : 0));
          setTimeout(function () {
            for (var _i3 in tombstoneAnimations) {
              var _animation2 = tombstoneAnimations[_i3];
              _animation2[0].style.display = 'none'; // Tombstone can be recycled now.

              _this3.tombstones.push(_animation2[0]);
            }
          }, ANIMATION_DURATION_MS);
        };

        InfiniteScroller.prototype._getTombStone = function () {
          var tombstone = this.tombstones.pop();

          if (tombstone) {
            tombstone.style.display = '';
            tombstone.style.opacity = 1;
            tombstone.style.transform = '';
            tombstone.style.transition = '';
            return tombstone;
          }

          return this.options.createTombstone();
        };

        InfiniteScroller.prototype._addItem = function () {
          this.items.push({
            data: null,
            node: null,
            height: 0,
            width: 0,
            top: 0
          });
        };

        InfiniteScroller.prototype._calculateAnchoredItem = function (initialAnchor, delta) {
          if (delta === 0) {
            return initialAnchor;
          }

          var i = initialAnchor.index;
          var tombstones = 0;
          delta += initialAnchor.offset;

          if (delta < 0) {
            while (delta < 0 && i > 0 && this.items[i - 1].height) {
              delta += this.items[i - 1].height;
              i--;
            }

            tombstones = Math.max(-i, Math.ceil(Math.min(delta, 0) / this.tombstoneHeight));
          } else {
            while (delta > 0 && i < this.items.length && this.items[i].height && this.items[i].height < delta) {
              delta -= this.items[i].height;
              i++;
            }

            if (i >= this.items.length || !this.items[i].height) {
              tombstones = Math.floor(Math.max(delta, 0) / this.tombstoneHeight);
            }
          }

          i += tombstones;
          delta -= tombstones * this.tombstoneHeight;
          return {
            index: i,
            offset: delta
          };
        };

        function BScroll(el, options) {
          this.wrapper = typeof el === 'string' ? document.querySelector(el) : el;

          if (!this.wrapper) {
            warn('Can not resolve the wrapper DOM.');
          }

          this.scroller = this.wrapper.children[0];

          if (!this.scroller) {
            warn('The wrapper need at least one child element to be scroller.');
          } // cache style for better performance


          this.scrollerStyle = this.scroller.style;

          this._init(el, options);
        }

        initMixin(BScroll);
        coreMixin(BScroll);
        eventMixin(BScroll);
        snapMixin(BScroll);
        wheelMixin(BScroll);
        scrollbarMixin(BScroll);
        pullDownMixin(BScroll);
        pullUpMixin(BScroll);
        mouseWheelMixin(BScroll);
        zoomMixin(BScroll);
        infiniteMixin(BScroll);
        BScroll.Version = '1.12.6';
        return BScroll;
      });
    }, {}],
    2: [function (require, module, exports) {
      (function (global) {
        /**
         * marked - a markdown parser
         * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed)
         * https://github.com/markedjs/marked
         */
        ;

        (function (root) {
          'use strict';
          /**
           * Block-Level Grammar
           */

          var block = {
            newline: /^\n+/,
            code: /^( {4}[^\n]+\n*)+/,
            fences: noop,
            hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
            heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,
            nptable: noop,
            blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
            list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
            html: '^ {0,3}(?:' // optional indentation
            + '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
            + '|comment[^\\n]*(\\n+|$)' // (2)
            + '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
            + '|<![A-Z][\\s\\S]*?>\\n*' // (4)
            + '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
            + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
            + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
            + '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
            + ')',
            def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
            table: noop,
            lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
            paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,
            text: /^[^\n]+/
          };
          block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
          block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
          block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
          block.bullet = /(?:[*+-]|\d+\.)/;
          block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
          block.item = edit(block.item, 'gm').replace(/bull/g, block.bullet).getRegex();
          block.list = edit(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
          block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
          block._comment = /<!--(?!-?>)[\s\S]*?-->/;
          block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
          block.paragraph = edit(block.paragraph).replace('hr', block.hr).replace('heading', block.heading).replace('lheading', block.lheading).replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
          .getRegex();
          block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
          /**
           * Normal Block Grammar
           */

          block.normal = merge({}, block);
          /**
           * GFM Block Grammar
           */

          block.gfm = merge({}, block.normal, {
            fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,
            paragraph: /^/,
            heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
          });
          block.gfm.paragraph = edit(block.paragraph).replace('(?!', '(?!' + block.gfm.fences.source.replace('\\1', '\\2') + '|' + block.list.source.replace('\\1', '\\3') + '|').getRegex();
          /**
           * GFM + Tables Block Grammar
           */

          block.tables = merge({}, block.gfm, {
            nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
            table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/
          });
          /**
           * Pedantic grammar
           */

          block.pedantic = merge({}, block.normal, {
            html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
            + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
            def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/
          });
          /**
           * Block Lexer
           */

          function Lexer(options) {
            this.tokens = [];
            this.tokens.links = Object.create(null);
            this.options = options || marked.defaults;
            this.rules = block.normal;

            if (this.options.pedantic) {
              this.rules = block.pedantic;
            } else if (this.options.gfm) {
              if (this.options.tables) {
                this.rules = block.tables;
              } else {
                this.rules = block.gfm;
              }
            }
          }
          /**
           * Expose Block Rules
           */


          Lexer.rules = block;
          /**
           * Static Lex Method
           */

          Lexer.lex = function (src, options) {
            var lexer = new Lexer(options);
            return lexer.lex(src);
          };
          /**
           * Preprocessing
           */


          Lexer.prototype.lex = function (src) {
            src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, '    ').replace(/\u00a0/g, ' ').replace(/\u2424/g, '\n');
            return this.token(src, true);
          };
          /**
           * Lexing
           */


          Lexer.prototype.token = function (src, top) {
            src = src.replace(/^ +$/gm, '');
            var next, loose, cap, bull, b, item, listStart, listItems, t, space, i, tag, l, isordered, istask, ischecked;

            while (src) {
              // newline
              if (cap = this.rules.newline.exec(src)) {
                src = src.substring(cap[0].length);

                if (cap[0].length > 1) {
                  this.tokens.push({
                    type: 'space'
                  });
                }
              } // code


              if (cap = this.rules.code.exec(src)) {
                src = src.substring(cap[0].length);
                cap = cap[0].replace(/^ {4}/gm, '');
                this.tokens.push({
                  type: 'code',
                  text: !this.options.pedantic ? rtrim(cap, '\n') : cap
                });
                continue;
              } // fences (gfm)


              if (cap = this.rules.fences.exec(src)) {
                src = src.substring(cap[0].length);
                this.tokens.push({
                  type: 'code',
                  lang: cap[2],
                  text: cap[3] || ''
                });
                continue;
              } // heading


              if (cap = this.rules.heading.exec(src)) {
                src = src.substring(cap[0].length);
                this.tokens.push({
                  type: 'heading',
                  depth: cap[1].length,
                  text: cap[2]
                });
                continue;
              } // table no leading pipe (gfm)


              if (top && (cap = this.rules.nptable.exec(src))) {
                item = {
                  type: 'table',
                  header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
                  align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
                  cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
                };

                if (item.header.length === item.align.length) {
                  src = src.substring(cap[0].length);

                  for (i = 0; i < item.align.length; i++) {
                    if (/^ *-+: *$/.test(item.align[i])) {
                      item.align[i] = 'right';
                    } else if (/^ *:-+: *$/.test(item.align[i])) {
                      item.align[i] = 'center';
                    } else if (/^ *:-+ *$/.test(item.align[i])) {
                      item.align[i] = 'left';
                    } else {
                      item.align[i] = null;
                    }
                  }

                  for (i = 0; i < item.cells.length; i++) {
                    item.cells[i] = splitCells(item.cells[i], item.header.length);
                  }

                  this.tokens.push(item);
                  continue;
                }
              } // hr


              if (cap = this.rules.hr.exec(src)) {
                src = src.substring(cap[0].length);
                this.tokens.push({
                  type: 'hr'
                });
                continue;
              } // blockquote


              if (cap = this.rules.blockquote.exec(src)) {
                src = src.substring(cap[0].length);
                this.tokens.push({
                  type: 'blockquote_start'
                });
                cap = cap[0].replace(/^ *> ?/gm, ''); // Pass `top` to keep the current
                // "toplevel" state. This is exactly
                // how markdown.pl works.

                this.token(cap, top);
                this.tokens.push({
                  type: 'blockquote_end'
                });
                continue;
              } // list


              if (cap = this.rules.list.exec(src)) {
                src = src.substring(cap[0].length);
                bull = cap[2];
                isordered = bull.length > 1;
                listStart = {
                  type: 'list_start',
                  ordered: isordered,
                  start: isordered ? +bull : '',
                  loose: false
                };
                this.tokens.push(listStart); // Get each top-level item.

                cap = cap[0].match(this.rules.item);
                listItems = [];
                next = false;
                l = cap.length;
                i = 0;

                for (; i < l; i++) {
                  item = cap[i]; // Remove the list item's bullet
                  // so it is seen as the next token.

                  space = item.length;
                  item = item.replace(/^ *([*+-]|\d+\.) +/, ''); // Outdent whatever the
                  // list item contains. Hacky.

                  if (~item.indexOf('\n ')) {
                    space -= item.length;
                    item = !this.options.pedantic ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') : item.replace(/^ {1,4}/gm, '');
                  } // Determine whether the next list item belongs here.
                  // Backpedal if it does not belong in this list.


                  if (this.options.smartLists && i !== l - 1) {
                    b = block.bullet.exec(cap[i + 1])[0];

                    if (bull !== b && !(bull.length > 1 && b.length > 1)) {
                      src = cap.slice(i + 1).join('\n') + src;
                      i = l - 1;
                    }
                  } // Determine whether item is loose or not.
                  // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
                  // for discount behavior.


                  loose = next || /\n\n(?!\s*$)/.test(item);

                  if (i !== l - 1) {
                    next = item.charAt(item.length - 1) === '\n';
                    if (!loose) loose = next;
                  }

                  if (loose) {
                    listStart.loose = true;
                  } // Check for task list items


                  istask = /^\[[ xX]\] /.test(item);
                  ischecked = undefined;

                  if (istask) {
                    ischecked = item[1] !== ' ';
                    item = item.replace(/^\[[ xX]\] +/, '');
                  }

                  t = {
                    type: 'list_item_start',
                    task: istask,
                    checked: ischecked,
                    loose: loose
                  };
                  listItems.push(t);
                  this.tokens.push(t); // Recurse.

                  this.token(item, false);
                  this.tokens.push({
                    type: 'list_item_end'
                  });
                }

                if (listStart.loose) {
                  l = listItems.length;
                  i = 0;

                  for (; i < l; i++) {
                    listItems[i].loose = true;
                  }
                }

                this.tokens.push({
                  type: 'list_end'
                });
                continue;
              } // html


              if (cap = this.rules.html.exec(src)) {
                src = src.substring(cap[0].length);
                this.tokens.push({
                  type: this.options.sanitize ? 'paragraph' : 'html',
                  pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
                  text: cap[0]
                });
                continue;
              } // def


              if (top && (cap = this.rules.def.exec(src))) {
                src = src.substring(cap[0].length);
                if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
                tag = cap[1].toLowerCase().replace(/\s+/g, ' ');

                if (!this.tokens.links[tag]) {
                  this.tokens.links[tag] = {
                    href: cap[2],
                    title: cap[3]
                  };
                }

                continue;
              } // table (gfm)


              if (top && (cap = this.rules.table.exec(src))) {
                item = {
                  type: 'table',
                  header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
                  align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
                  cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : []
                };

                if (item.header.length === item.align.length) {
                  src = src.substring(cap[0].length);

                  for (i = 0; i < item.align.length; i++) {
                    if (/^ *-+: *$/.test(item.align[i])) {
                      item.align[i] = 'right';
                    } else if (/^ *:-+: *$/.test(item.align[i])) {
                      item.align[i] = 'center';
                    } else if (/^ *:-+ *$/.test(item.align[i])) {
                      item.align[i] = 'left';
                    } else {
                      item.align[i] = null;
                    }
                  }

                  for (i = 0; i < item.cells.length; i++) {
                    item.cells[i] = splitCells(item.cells[i].replace(/^ *\| *| *\| *$/g, ''), item.header.length);
                  }

                  this.tokens.push(item);
                  continue;
                }
              } // lheading


              if (cap = this.rules.lheading.exec(src)) {
                src = src.substring(cap[0].length);
                this.tokens.push({
                  type: 'heading',
                  depth: cap[2] === '=' ? 1 : 2,
                  text: cap[1]
                });
                continue;
              } // top-level paragraph


              if (top && (cap = this.rules.paragraph.exec(src))) {
                src = src.substring(cap[0].length);
                this.tokens.push({
                  type: 'paragraph',
                  text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1]
                });
                continue;
              } // text


              if (cap = this.rules.text.exec(src)) {
                // Top-level should never reach here.
                src = src.substring(cap[0].length);
                this.tokens.push({
                  type: 'text',
                  text: cap[0]
                });
                continue;
              }

              if (src) {
                throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
              }
            }

            return this.tokens;
          };
          /**
           * Inline-Level Grammar
           */


          var inline = {
            escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
            autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
            url: noop,
            tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
            + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
            + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
            + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
            + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
            // CDATA section
            link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,
            reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
            nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
            strong: /^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
            em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\s.])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\s.])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
            code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
            br: /^( {2,}|\\)\n(?!\s*$)/,
            del: noop,
            text: /^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|\b_| {2,}\n|$)/
          };
          inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
          inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
          inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
          inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
          inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
          inline.tag = edit(inline.tag).replace('comment', block._comment).replace('attribute', inline._attribute).getRegex();
          inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/;
          inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/;
          inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
          inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
          inline.reflink = edit(inline.reflink).replace('label', inline._label).getRegex();
          /**
           * Normal Inline Grammar
           */

          inline.normal = merge({}, inline);
          /**
           * Pedantic Inline Grammar
           */

          inline.pedantic = merge({}, inline.normal, {
            strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
            em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
            link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
            reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
          });
          /**
           * GFM Inline Grammar
           */

          inline.gfm = merge({}, inline.normal, {
            escape: edit(inline.escape).replace('])', '~|])').getRegex(),
            _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
            url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
            _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
            del: /^~+(?=\S)([\s\S]*?\S)~+/,
            text: edit(inline.text).replace(']|', '~]|').replace('|$', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|$').getRegex()
          });
          inline.gfm.url = edit(inline.gfm.url).replace('email', inline.gfm._extended_email).getRegex();
          /**
           * GFM + Line Breaks Inline Grammar
           */

          inline.breaks = merge({}, inline.gfm, {
            br: edit(inline.br).replace('{2,}', '*').getRegex(),
            text: edit(inline.gfm.text).replace('{2,}', '*').getRegex()
          });
          /**
           * Inline Lexer & Compiler
           */

          function InlineLexer(links, options) {
            this.options = options || marked.defaults;
            this.links = links;
            this.rules = inline.normal;
            this.renderer = this.options.renderer || new Renderer();
            this.renderer.options = this.options;

            if (!this.links) {
              throw new Error('Tokens array requires a `links` property.');
            }

            if (this.options.pedantic) {
              this.rules = inline.pedantic;
            } else if (this.options.gfm) {
              if (this.options.breaks) {
                this.rules = inline.breaks;
              } else {
                this.rules = inline.gfm;
              }
            }
          }
          /**
           * Expose Inline Rules
           */


          InlineLexer.rules = inline;
          /**
           * Static Lexing/Compiling Method
           */

          InlineLexer.output = function (src, links, options) {
            var inline = new InlineLexer(links, options);
            return inline.output(src);
          };
          /**
           * Lexing/Compiling
           */


          InlineLexer.prototype.output = function (src) {
            var out = '',
                link,
                text,
                href,
                title,
                cap,
                prevCapZero;

            while (src) {
              // escape
              if (cap = this.rules.escape.exec(src)) {
                src = src.substring(cap[0].length);
                out += cap[1];
                continue;
              } // autolink


              if (cap = this.rules.autolink.exec(src)) {
                src = src.substring(cap[0].length);

                if (cap[2] === '@') {
                  text = escape(this.mangle(cap[1]));
                  href = 'mailto:' + text;
                } else {
                  text = escape(cap[1]);
                  href = text;
                }

                out += this.renderer.link(href, null, text);
                continue;
              } // url (gfm)


              if (!this.inLink && (cap = this.rules.url.exec(src))) {
                if (cap[2] === '@') {
                  text = escape(cap[0]);
                  href = 'mailto:' + text;
                } else {
                  // do extended autolink path validation
                  do {
                    prevCapZero = cap[0];
                    cap[0] = this.rules._backpedal.exec(cap[0])[0];
                  } while (prevCapZero !== cap[0]);

                  text = escape(cap[0]);

                  if (cap[1] === 'www.') {
                    href = 'http://' + text;
                  } else {
                    href = text;
                  }
                }

                src = src.substring(cap[0].length);
                out += this.renderer.link(href, null, text);
                continue;
              } // tag


              if (cap = this.rules.tag.exec(src)) {
                if (!this.inLink && /^<a /i.test(cap[0])) {
                  this.inLink = true;
                } else if (this.inLink && /^<\/a>/i.test(cap[0])) {
                  this.inLink = false;
                }

                if (!this.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
                  this.inRawBlock = true;
                } else if (this.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
                  this.inRawBlock = false;
                }

                src = src.substring(cap[0].length);
                out += this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
                continue;
              } // link


              if (cap = this.rules.link.exec(src)) {
                src = src.substring(cap[0].length);
                this.inLink = true;
                href = cap[2];

                if (this.options.pedantic) {
                  link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);

                  if (link) {
                    href = link[1];
                    title = link[3];
                  } else {
                    title = '';
                  }
                } else {
                  title = cap[3] ? cap[3].slice(1, -1) : '';
                }

                href = href.trim().replace(/^<([\s\S]*)>$/, '$1');
                out += this.outputLink(cap, {
                  href: InlineLexer.escapes(href),
                  title: InlineLexer.escapes(title)
                });
                this.inLink = false;
                continue;
              } // reflink, nolink


              if ((cap = this.rules.reflink.exec(src)) || (cap = this.rules.nolink.exec(src))) {
                src = src.substring(cap[0].length);
                link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
                link = this.links[link.toLowerCase()];

                if (!link || !link.href) {
                  out += cap[0].charAt(0);
                  src = cap[0].substring(1) + src;
                  continue;
                }

                this.inLink = true;
                out += this.outputLink(cap, link);
                this.inLink = false;
                continue;
              } // strong


              if (cap = this.rules.strong.exec(src)) {
                src = src.substring(cap[0].length);
                out += this.renderer.strong(this.output(cap[4] || cap[3] || cap[2] || cap[1]));
                continue;
              } // em


              if (cap = this.rules.em.exec(src)) {
                src = src.substring(cap[0].length);
                out += this.renderer.em(this.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1]));
                continue;
              } // code


              if (cap = this.rules.code.exec(src)) {
                src = src.substring(cap[0].length);
                out += this.renderer.codespan(escape(cap[2].trim(), true));
                continue;
              } // br


              if (cap = this.rules.br.exec(src)) {
                src = src.substring(cap[0].length);
                out += this.renderer.br();
                continue;
              } // del (gfm)


              if (cap = this.rules.del.exec(src)) {
                src = src.substring(cap[0].length);
                out += this.renderer.del(this.output(cap[1]));
                continue;
              } // text


              if (cap = this.rules.text.exec(src)) {
                src = src.substring(cap[0].length);

                if (this.inRawBlock) {
                  out += this.renderer.text(cap[0]);
                } else {
                  out += this.renderer.text(escape(this.smartypants(cap[0])));
                }

                continue;
              }

              if (src) {
                throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
              }
            }

            return out;
          };

          InlineLexer.escapes = function (text) {
            return text ? text.replace(InlineLexer.rules._escapes, '$1') : text;
          };
          /**
           * Compile Link
           */


          InlineLexer.prototype.outputLink = function (cap, link) {
            var href = link.href,
                title = link.title ? escape(link.title) : null;
            return cap[0].charAt(0) !== '!' ? this.renderer.link(href, title, this.output(cap[1])) : this.renderer.image(href, title, escape(cap[1]));
          };
          /**
           * Smartypants Transformations
           */


          InlineLexer.prototype.smartypants = function (text) {
            if (!this.options.smartypants) return text;
            return text // em-dashes
            .replace(/---/g, "\u2014") // en-dashes
            .replace(/--/g, "\u2013") // opening singles
            .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
            .replace(/'/g, "\u2019") // opening doubles
            .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
            .replace(/"/g, "\u201D") // ellipses
            .replace(/\.{3}/g, "\u2026");
          };
          /**
           * Mangle Links
           */


          InlineLexer.prototype.mangle = function (text) {
            if (!this.options.mangle) return text;
            var out = '',
                l = text.length,
                i = 0,
                ch;

            for (; i < l; i++) {
              ch = text.charCodeAt(i);

              if (Math.random() > 0.5) {
                ch = 'x' + ch.toString(16);
              }

              out += '&#' + ch + ';';
            }

            return out;
          };
          /**
           * Renderer
           */


          function Renderer(options) {
            this.options = options || marked.defaults;
          }

          Renderer.prototype.code = function (code, lang, escaped) {
            if (this.options.highlight) {
              var out = this.options.highlight(code, lang);

              if (out != null && out !== code) {
                escaped = true;
                code = out;
              }
            }

            if (!lang) {
              return '<pre><code>' + (escaped ? code : escape(code, true)) + '</code></pre>';
            }

            return '<pre><code class="' + this.options.langPrefix + escape(lang, true) + '">' + (escaped ? code : escape(code, true)) + '</code></pre>\n';
          };

          Renderer.prototype.blockquote = function (quote) {
            return '<blockquote>\n' + quote + '</blockquote>\n';
          };

          Renderer.prototype.html = function (html) {
            return html;
          };

          Renderer.prototype.heading = function (text, level, raw) {
            if (this.options.headerIds) {
              return '<h' + level + ' id="' + this.options.headerPrefix + raw.toLowerCase().replace(/[^\w]+/g, '-') + '">' + text + '</h' + level + '>\n';
            } // ignore IDs


            return '<h' + level + '>' + text + '</h' + level + '>\n';
          };

          Renderer.prototype.hr = function () {
            return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
          };

          Renderer.prototype.list = function (body, ordered, start) {
            var type = ordered ? 'ol' : 'ul',
                startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
            return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
          };

          Renderer.prototype.listitem = function (text) {
            return '<li>' + text + '</li>\n';
          };

          Renderer.prototype.checkbox = function (checked) {
            return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
          };

          Renderer.prototype.paragraph = function (text) {
            return '<p>' + text + '</p>\n';
          };

          Renderer.prototype.table = function (header, body) {
            if (body) body = '<tbody>' + body + '</tbody>';
            return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
          };

          Renderer.prototype.tablerow = function (content) {
            return '<tr>\n' + content + '</tr>\n';
          };

          Renderer.prototype.tablecell = function (content, flags) {
            var type = flags.header ? 'th' : 'td';
            var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>';
            return tag + content + '</' + type + '>\n';
          }; // span level renderer


          Renderer.prototype.strong = function (text) {
            return '<strong>' + text + '</strong>';
          };

          Renderer.prototype.em = function (text) {
            return '<em>' + text + '</em>';
          };

          Renderer.prototype.codespan = function (text) {
            return '<code>' + text + '</code>';
          };

          Renderer.prototype.br = function () {
            return this.options.xhtml ? '<br/>' : '<br>';
          };

          Renderer.prototype.del = function (text) {
            return '<del>' + text + '</del>';
          };

          Renderer.prototype.link = function (href, title, text) {
            href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);

            if (href === null) {
              return text;
            }

            var out = '<a target="_blank" href="' + escape(href) + '"';

            if (title) {
              out += ' title="' + title + '"';
            }

            out += '>' + text + '</a>';
            return out;
          };

          Renderer.prototype.image = function (href, title, text) {
            href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);

            if (href === null) {
              return text;
            }

            var out = '<img src="' + href + '" alt="' + text + '"';

            if (title) {
              out += ' title="' + title + '"';
            }

            out += this.options.xhtml ? '/>' : '>';
            return out;
          };

          Renderer.prototype.text = function (text) {
            return text;
          };
          /**
           * TextRenderer
           * returns only the textual part of the token
           */


          function TextRenderer() {} // no need for block level renderers


          TextRenderer.prototype.strong = TextRenderer.prototype.em = TextRenderer.prototype.codespan = TextRenderer.prototype.del = TextRenderer.prototype.text = function (text) {
            return text;
          };

          TextRenderer.prototype.link = TextRenderer.prototype.image = function (href, title, text) {
            return '' + text;
          };

          TextRenderer.prototype.br = function () {
            return '';
          };
          /**
           * Parsing & Compiling
           */


          function Parser(options) {
            this.tokens = [];
            this.token = null;
            this.options = options || marked.defaults;
            this.options.renderer = this.options.renderer || new Renderer();
            this.renderer = this.options.renderer;
            this.renderer.options = this.options;
          }
          /**
           * Static Parse Method
           */


          Parser.parse = function (src, options) {
            var parser = new Parser(options);
            return parser.parse(src);
          };
          /**
           * Parse Loop
           */


          Parser.prototype.parse = function (src) {
            this.inline = new InlineLexer(src.links, this.options); // use an InlineLexer with a TextRenderer to extract pure text

            this.inlineText = new InlineLexer(src.links, merge({}, this.options, {
              renderer: new TextRenderer()
            }));
            this.tokens = src.reverse();
            var out = '';

            while (this.next()) {
              out += this.tok();
            }

            return out;
          };
          /**
           * Next Token
           */


          Parser.prototype.next = function () {
            return this.token = this.tokens.pop();
          };
          /**
           * Preview Next Token
           */


          Parser.prototype.peek = function () {
            return this.tokens[this.tokens.length - 1] || 0;
          };
          /**
           * Parse Text Tokens
           */


          Parser.prototype.parseText = function () {
            var body = this.token.text;

            while (this.peek().type === 'text') {
              body += '\n' + this.next().text;
            }

            return this.inline.output(body);
          };
          /**
           * Parse Current Token
           */


          Parser.prototype.tok = function () {
            switch (this.token.type) {
              case 'space':
                {
                  return '';
                }

              case 'hr':
                {
                  return this.renderer.hr();
                }

              case 'heading':
                {
                  return this.renderer.heading(this.inline.output(this.token.text), this.token.depth, unescape(this.inlineText.output(this.token.text)));
                }

              case 'code':
                {
                  return this.renderer.code(this.token.text, this.token.lang, this.token.escaped);
                }

              case 'table':
                {
                  var header = '',
                      body = '',
                      i,
                      row,
                      cell,
                      j; // header

                  cell = '';

                  for (i = 0; i < this.token.header.length; i++) {
                    cell += this.renderer.tablecell(this.inline.output(this.token.header[i]), {
                      header: true,
                      align: this.token.align[i]
                    });
                  }

                  header += this.renderer.tablerow(cell);

                  for (i = 0; i < this.token.cells.length; i++) {
                    row = this.token.cells[i];
                    cell = '';

                    for (j = 0; j < row.length; j++) {
                      cell += this.renderer.tablecell(this.inline.output(row[j]), {
                        header: false,
                        align: this.token.align[j]
                      });
                    }

                    body += this.renderer.tablerow(cell);
                  }

                  return this.renderer.table(header, body);
                }

              case 'blockquote_start':
                {
                  body = '';

                  while (this.next().type !== 'blockquote_end') {
                    body += this.tok();
                  }

                  return this.renderer.blockquote(body);
                }

              case 'list_start':
                {
                  body = '';
                  var ordered = this.token.ordered,
                      start = this.token.start;

                  while (this.next().type !== 'list_end') {
                    body += this.tok();
                  }

                  return this.renderer.list(body, ordered, start);
                }

              case 'list_item_start':
                {
                  body = '';
                  var loose = this.token.loose;

                  if (this.token.task) {
                    body += this.renderer.checkbox(this.token.checked);
                  }

                  while (this.next().type !== 'list_item_end') {
                    body += !loose && this.token.type === 'text' ? this.parseText() : this.tok();
                  }

                  return this.renderer.listitem(body);
                }

              case 'html':
                {
                  // TODO parse inline content if parameter markdown=1
                  return this.renderer.html(this.token.text);
                }

              case 'paragraph':
                {
                  return this.renderer.paragraph(this.inline.output(this.token.text));
                }

              case 'text':
                {
                  return this.renderer.paragraph(this.parseText());
                }
            }
          };
          /**
           * Helpers
           */


          function escape(html, encode) {
            if (encode) {
              if (escape.escapeTest.test(html)) {
                return html.replace(escape.escapeReplace, function (ch) {
                  return escape.replacements[ch];
                });
              }
            } else {
              if (escape.escapeTestNoEncode.test(html)) {
                return html.replace(escape.escapeReplaceNoEncode, function (ch) {
                  return escape.replacements[ch];
                });
              }
            }

            return html;
          }

          escape.escapeTest = /[&<>"']/;
          escape.escapeReplace = /[&<>"']/g;
          escape.replacements = {
            '&': '&amp;',
            '<': '&lt;',
            '>': '&gt;',
            '"': '&quot;',
            "'": '&#39;'
          };
          escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
          escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;

          function unescape(html) {
            // explicitly match decimal, hex, and named HTML entities
            return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function (_, n) {
              n = n.toLowerCase();
              if (n === 'colon') return ':';

              if (n.charAt(0) === '#') {
                return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
              }

              return '';
            });
          }

          function edit(regex, opt) {
            regex = regex.source || regex;
            opt = opt || '';
            return {
              replace: function replace(name, val) {
                val = val.source || val;
                val = val.replace(/(^|[^\[])\^/g, '$1');
                regex = regex.replace(name, val);
                return this;
              },
              getRegex: function getRegex() {
                return new RegExp(regex, opt);
              }
            };
          }

          function cleanUrl(sanitize, base, href) {
            if (sanitize) {
              try {
                var prot = decodeURIComponent(unescape(href)).replace(/[^\w:]/g, '').toLowerCase();
              } catch (e) {
                return null;
              }

              if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
                return null;
              }
            }

            if (base && !originIndependentUrl.test(href)) {
              href = resolveUrl(base, href);
            }

            try {
              href = encodeURI(href).replace(/%25/g, '%');
            } catch (e) {
              return null;
            }

            return href;
          }

          function resolveUrl(base, href) {
            if (!baseUrls[' ' + base]) {
              // we can ignore everything in base after the last slash of its path component,
              // but we might need to add _that_
              // https://tools.ietf.org/html/rfc3986#section-3
              if (/^[^:]+:\/*[^/]*$/.test(base)) {
                baseUrls[' ' + base] = base + '/';
              } else {
                baseUrls[' ' + base] = rtrim(base, '/', true);
              }
            }

            base = baseUrls[' ' + base];

            if (href.slice(0, 2) === '//') {
              return base.replace(/:[\s\S]*/, ':') + href;
            } else if (href.charAt(0) === '/') {
              return base.replace(/(:\/*[^/]*)[\s\S]*/, '$1') + href;
            } else {
              return base + href;
            }
          }

          var baseUrls = {};
          var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;

          function noop() {}

          noop.exec = noop;

          function merge(obj) {
            var i = 1,
                target,
                key;

            for (; i < arguments.length; i++) {
              target = arguments[i];

              for (key in target) {
                if (Object.prototype.hasOwnProperty.call(target, key)) {
                  obj[key] = target[key];
                }
              }
            }

            return obj;
          }

          function splitCells(tableRow, count) {
            // ensure that every cell-delimiting pipe has a space
            // before it to distinguish it from an escaped pipe
            var row = tableRow.replace(/\|/g, function (match, offset, str) {
              var escaped = false,
                  curr = offset;

              while (--curr >= 0 && str[curr] === '\\') {
                escaped = !escaped;
              }

              if (escaped) {
                // odd number of slashes means | is escaped
                // so we leave it alone
                return '|';
              } else {
                // add space before unescaped |
                return ' |';
              }
            }),
                cells = row.split(/ \|/),
                i = 0;

            if (cells.length > count) {
              cells.splice(count);
            } else {
              while (cells.length < count) {
                cells.push('');
              }
            }

            for (; i < cells.length; i++) {
              // leading or trailing whitespace is ignored per the gfm spec
              cells[i] = cells[i].trim().replace(/\\\|/g, '|');
            }

            return cells;
          } // Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
          // /c*$/ is vulnerable to REDOS.
          // invert: Remove suffix of non-c chars instead. Default falsey.


          function rtrim(str, c, invert) {
            if (str.length === 0) {
              return '';
            } // Length of suffix matching the invert condition.


            var suffLen = 0; // Step left until we fail to match the invert condition.

            while (suffLen < str.length) {
              var currChar = str.charAt(str.length - suffLen - 1);

              if (currChar === c && !invert) {
                suffLen++;
              } else if (currChar !== c && invert) {
                suffLen++;
              } else {
                break;
              }
            }

            return str.substr(0, str.length - suffLen);
          }
          /**
           * Marked
           */


          function marked(src, opt, callback) {
            // throw error in case of non string input
            if (typeof src === 'undefined' || src === null) {
              throw new Error('marked(): input parameter is undefined or null');
            }

            if (typeof src !== 'string') {
              throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
            }

            if (callback || typeof opt === 'function') {
              if (!callback) {
                callback = opt;
                opt = null;
              }

              opt = merge({}, marked.defaults, opt || {});
              var highlight = opt.highlight,
                  tokens,
                  pending,
                  i = 0;

              try {
                tokens = Lexer.lex(src, opt);
              } catch (e) {
                return callback(e);
              }

              pending = tokens.length;

              var done = function done(err) {
                if (err) {
                  opt.highlight = highlight;
                  return callback(err);
                }

                var out;

                try {
                  out = Parser.parse(tokens, opt);
                } catch (e) {
                  err = e;
                }

                opt.highlight = highlight;
                return err ? callback(err) : callback(null, out);
              };

              if (!highlight || highlight.length < 3) {
                return done();
              }

              delete opt.highlight;
              if (!pending) return done();

              for (; i < tokens.length; i++) {
                (function (token) {
                  if (token.type !== 'code') {
                    return --pending || done();
                  }

                  return highlight(token.text, token.lang, function (err, code) {
                    if (err) return done(err);

                    if (code == null || code === token.text) {
                      return --pending || done();
                    }

                    token.text = code;
                    token.escaped = true;
                    --pending || done();
                  });
                })(tokens[i]);
              }

              return;
            }

            try {
              if (opt) opt = merge({}, marked.defaults, opt);
              return Parser.parse(Lexer.lex(src, opt), opt);
            } catch (e) {
              e.message += '\nPlease report this to https://github.com/markedjs/marked.';

              if ((opt || marked.defaults).silent) {
                return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
              }

              throw e;
            }
          }
          /**
           * Options
           */


          marked.options = marked.setOptions = function (opt) {
            merge(marked.defaults, opt);
            return marked;
          };

          marked.getDefaults = function () {
            return {
              baseUrl: null,
              breaks: false,
              gfm: true,
              headerIds: true,
              headerPrefix: '',
              highlight: null,
              langPrefix: 'language-',
              mangle: true,
              pedantic: false,
              renderer: new Renderer(),
              sanitize: false,
              sanitizer: null,
              silent: false,
              smartLists: false,
              smartypants: false,
              tables: true,
              xhtml: false
            };
          };

          marked.defaults = marked.getDefaults();
          /**
           * Expose
           */

          marked.Parser = Parser;
          marked.parser = Parser.parse;
          marked.Renderer = Renderer;
          marked.TextRenderer = TextRenderer;
          marked.Lexer = Lexer;
          marked.lexer = Lexer.lex;
          marked.InlineLexer = InlineLexer;
          marked.inlineLexer = InlineLexer.output;
          marked.parse = marked;

          if (typeof module !== 'undefined' && _typeof(exports) === 'object') {
            module.exports = marked;
          } else if (typeof define === 'function' && define.amd) {
            define(function () {
              return marked;
            });
          } else {
            root.marked = marked;
          }
        })(this || (typeof window !== 'undefined' ? window : global));
      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
    }, {}],
    3: [function (require, module, exports) {
      (function (global) {
        /* **********************************************
             Begin prism-core.js
        ********************************************** */
        var _self = typeof window !== 'undefined' ? window // if in browser
        : typeof WorkerGlobalScope !== 'undefined' && _instanceof(self, WorkerGlobalScope) ? self // if in worker
        : {} // if in node js
        ;
        /**
         * Prism: Lightweight, robust, elegant syntax highlighting
         * MIT license http://www.opensource.org/licenses/mit-license.php/
         * @author Lea Verou http://lea.verou.me
         */


        var Prism = function () {
          // Private helper vars
          var lang = /\blang(?:uage)?-([\w-]+)\b/i;
          var uniqueId = 0;

          var _ = _self.Prism = {
            manual: _self.Prism && _self.Prism.manual,
            disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
            util: {
              encode: function encode(tokens) {
                if (_instanceof(tokens, Token)) {
                  return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
                } else if (_.util.type(tokens) === 'Array') {
                  return tokens.map(_.util.encode);
                } else {
                  return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
                }
              },
              type: function type(o) {
                return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
              },
              objId: function objId(obj) {
                if (!obj['__id']) {
                  Object.defineProperty(obj, '__id', {
                    value: ++uniqueId
                  });
                }

                return obj['__id'];
              },
              // Deep clone a language definition (e.g. to extend it)
              clone: function clone(o, visited) {
                var type = _.util.type(o);

                visited = visited || {};

                switch (type) {
                  case 'Object':
                    if (visited[_.util.objId(o)]) {
                      return visited[_.util.objId(o)];
                    }

                    var clone = {};
                    visited[_.util.objId(o)] = clone;

                    for (var key in o) {
                      if (o.hasOwnProperty(key)) {
                        clone[key] = _.util.clone(o[key], visited);
                      }
                    }

                    return clone;

                  case 'Array':
                    if (visited[_.util.objId(o)]) {
                      return visited[_.util.objId(o)];
                    }

                    var clone = [];
                    visited[_.util.objId(o)] = clone;
                    o.forEach(function (v, i) {
                      clone[i] = _.util.clone(v, visited);
                    });
                    return clone;
                }

                return o;
              }
            },
            languages: {
              extend: function extend(id, redef) {
                var lang = _.util.clone(_.languages[id]);

                for (var key in redef) {
                  lang[key] = redef[key];
                }

                return lang;
              },

              /**
               * Insert a token before another token in a language literal
               * As this needs to recreate the object (we cannot actually insert before keys in object literals),
               * we cannot just provide an object, we need anobject and a key.
               * @param inside The key (or language id) of the parent
               * @param before The key to insert before. If not provided, the function appends instead.
               * @param insert Object with the key/value pairs to insert
               * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
               */
              insertBefore: function insertBefore(inside, before, insert, root) {
                root = root || _.languages;
                var grammar = root[inside];

                if (arguments.length == 2) {
                  insert = arguments[1];

                  for (var newToken in insert) {
                    if (insert.hasOwnProperty(newToken)) {
                      grammar[newToken] = insert[newToken];
                    }
                  }

                  return grammar;
                }

                var ret = {};

                for (var token in grammar) {
                  if (grammar.hasOwnProperty(token)) {
                    if (token == before) {
                      for (var newToken in insert) {
                        if (insert.hasOwnProperty(newToken)) {
                          ret[newToken] = insert[newToken];
                        }
                      }
                    }

                    ret[token] = grammar[token];
                  }
                } // Update references in other language definitions


                _.languages.DFS(_.languages, function (key, value) {
                  if (value === root[inside] && key != inside) {
                    this[key] = ret;
                  }
                });

                return root[inside] = ret;
              },
              // Traverse a language definition with Depth First Search
              DFS: function DFS(o, callback, type, visited) {
                visited = visited || {};

                for (var i in o) {
                  if (o.hasOwnProperty(i)) {
                    callback.call(o, i, o[i], type || i);

                    if (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {
                      visited[_.util.objId(o[i])] = true;

                      _.languages.DFS(o[i], callback, null, visited);
                    } else if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {
                      visited[_.util.objId(o[i])] = true;

                      _.languages.DFS(o[i], callback, i, visited);
                    }
                  }
                }
              }
            },
            plugins: {},
            highlightAll: function highlightAll(async, callback) {
              _.highlightAllUnder(document, async, callback);
            },
            highlightAllUnder: function highlightAllUnder(container, async, callback) {
              var env = {
                callback: callback,
                selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
              };

              _.hooks.run("before-highlightall", env);

              var elements = env.elements || container.querySelectorAll(env.selector);

              for (var i = 0, element; element = elements[i++];) {
                _.highlightElement(element, async === true, env.callback);
              }
            },
            highlightElement: function highlightElement(element, async, callback) {
              // Find language
              var language,
                  grammar,
                  parent = element;

              while (parent && !lang.test(parent.className)) {
                parent = parent.parentNode;
              }

              if (parent) {
                language = (parent.className.match(lang) || [, ''])[1].toLowerCase();
                grammar = _.languages[language];
              } // Set language on the element, if not present


              element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;

              if (element.parentNode) {
                // Set language on the parent, for styling
                parent = element.parentNode;

                if (/pre/i.test(parent.nodeName)) {
                  parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
                }
              }

              var code = element.textContent;
              var env = {
                element: element,
                language: language,
                grammar: grammar,
                code: code
              };

              _.hooks.run('before-sanity-check', env);

              if (!env.code || !env.grammar) {
                if (env.code) {
                  _.hooks.run('before-highlight', env);

                  env.element.textContent = env.code;

                  _.hooks.run('after-highlight', env);
                }

                _.hooks.run('complete', env);

                return;
              }

              _.hooks.run('before-highlight', env);

              if (async && _self.Worker) {
                var worker = new Worker(_.filename);

                worker.onmessage = function (evt) {
                  env.highlightedCode = evt.data;

                  _.hooks.run('before-insert', env);

                  env.element.innerHTML = env.highlightedCode;
                  callback && callback.call(env.element);

                  _.hooks.run('after-highlight', env);

                  _.hooks.run('complete', env);
                };

                worker.postMessage(JSON.stringify({
                  language: env.language,
                  code: env.code,
                  immediateClose: true
                }));
              } else {
                env.highlightedCode = _.highlight(env.code, env.grammar, env.language);

                _.hooks.run('before-insert', env);

                env.element.innerHTML = env.highlightedCode;
                callback && callback.call(element);

                _.hooks.run('after-highlight', env);

                _.hooks.run('complete', env);
              }
            },
            highlight: function highlight(text, grammar, language) {
              var env = {
                code: text,
                grammar: grammar,
                language: language
              };

              _.hooks.run('before-tokenize', env);

              env.tokens = _.tokenize(env.code, env.grammar);

              _.hooks.run('after-tokenize', env);

              return Token.stringify(_.util.encode(env.tokens), env.language);
            },
            matchGrammar: function matchGrammar(text, strarr, grammar, index, startPos, oneshot, target) {
              var Token = _.Token;

              for (var token in grammar) {
                if (!grammar.hasOwnProperty(token) || !grammar[token]) {
                  continue;
                }

                if (token == target) {
                  return;
                }

                var patterns = grammar[token];
                patterns = _.util.type(patterns) === "Array" ? patterns : [patterns];

                for (var j = 0; j < patterns.length; ++j) {
                  var pattern = patterns[j],
                      inside = pattern.inside,
                      lookbehind = !!pattern.lookbehind,
                      greedy = !!pattern.greedy,
                      lookbehindLength = 0,
                      alias = pattern.alias;

                  if (greedy && !pattern.pattern.global) {
                    // Without the global flag, lastIndex won't work
                    var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
                    pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
                  }

                  pattern = pattern.pattern || pattern; // Don’t cache length as it changes during the loop

                  for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
                    var str = strarr[i];

                    if (strarr.length > text.length) {
                      // Something went terribly wrong, ABORT, ABORT!
                      return;
                    }

                    if (_instanceof(str, Token)) {
                      continue;
                    }

                    if (greedy && i != strarr.length - 1) {
                      pattern.lastIndex = pos;
                      var match = pattern.exec(text);

                      if (!match) {
                        break;
                      }

                      var from = match.index + (lookbehind ? match[1].length : 0),
                          to = match.index + match[0].length,
                          k = i,
                          p = pos;

                      for (var len = strarr.length; k < len && (p < to || !strarr[k].type && !strarr[k - 1].greedy); ++k) {
                        p += strarr[k].length; // Move the index i to the element in strarr that is closest to from

                        if (from >= p) {
                          ++i;
                          pos = p;
                        }
                      } // If strarr[i] is a Token, then the match starts inside another Token, which is invalid


                      if (_instanceof(strarr[i], Token)) {
                        continue;
                      } // Number of tokens to delete and replace with the new match


                      delNum = k - i;
                      str = text.slice(pos, p);
                      match.index -= pos;
                    } else {
                      pattern.lastIndex = 0;
                      var match = pattern.exec(str),
                          delNum = 1;
                    }

                    if (!match) {
                      if (oneshot) {
                        break;
                      }

                      continue;
                    }

                    if (lookbehind) {
                      lookbehindLength = match[1] ? match[1].length : 0;
                    }

                    var from = match.index + lookbehindLength,
                        match = match[0].slice(lookbehindLength),
                        to = from + match.length,
                        before = str.slice(0, from),
                        after = str.slice(to);
                    var args = [i, delNum];

                    if (before) {
                      ++i;
                      pos += before.length;
                      args.push(before);
                    }

                    var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias, match, greedy);
                    args.push(wrapped);

                    if (after) {
                      args.push(after);
                    }

                    Array.prototype.splice.apply(strarr, args);
                    if (delNum != 1) _.matchGrammar(text, strarr, grammar, i, pos, true, token);
                    if (oneshot) break;
                  }
                }
              }
            },
            tokenize: function tokenize(text, grammar, language) {
              var strarr = [text];
              var rest = grammar.rest;

              if (rest) {
                for (var token in rest) {
                  grammar[token] = rest[token];
                }

                delete grammar.rest;
              }

              _.matchGrammar(text, strarr, grammar, 0, 0, false);

              return strarr;
            },
            hooks: {
              all: {},
              add: function add(name, callback) {
                var hooks = _.hooks.all;
                hooks[name] = hooks[name] || [];
                hooks[name].push(callback);
              },
              run: function run(name, env) {
                var callbacks = _.hooks.all[name];

                if (!callbacks || !callbacks.length) {
                  return;
                }

                for (var i = 0, callback; callback = callbacks[i++];) {
                  callback(env);
                }
              }
            }
          };

          var Token = _.Token = function (type, content, alias, matchedStr, greedy) {
            this.type = type;
            this.content = content;
            this.alias = alias; // Copy of the full string this token was created from

            this.length = (matchedStr || "").length | 0;
            this.greedy = !!greedy;
          };

          Token.stringify = function (o, language, parent) {
            if (typeof o == 'string') {
              return o;
            }

            if (_.util.type(o) === 'Array') {
              return o.map(function (element) {
                return Token.stringify(element, language, o);
              }).join('');
            }

            var env = {
              type: o.type,
              content: Token.stringify(o.content, language, parent),
              tag: 'span',
              classes: ['token', o.type],
              attributes: {},
              language: language,
              parent: parent
            };

            if (o.alias) {
              var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
              Array.prototype.push.apply(env.classes, aliases);
            }

            _.hooks.run('wrap', env);

            var attributes = Object.keys(env.attributes).map(function (name) {
              return name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
            }).join(' ');
            return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
          };

          if (!_self.document) {
            if (!_self.addEventListener) {
              // in Node.js
              return _self.Prism;
            }

            if (!_.disableWorkerMessageHandler) {
              // In worker
              _self.addEventListener('message', function (evt) {
                var message = JSON.parse(evt.data),
                    lang = message.language,
                    code = message.code,
                    immediateClose = message.immediateClose;

                _self.postMessage(_.highlight(code, _.languages[lang], lang));

                if (immediateClose) {
                  _self.close();
                }
              }, false);
            }

            return _self.Prism;
          } //Get current script and highlight


          var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();

          if (script) {
            _.filename = script.src;

            if (!_.manual && !script.hasAttribute('data-manual')) {
              if (document.readyState !== "loading") {
                if (window.requestAnimationFrame) {
                  window.requestAnimationFrame(_.highlightAll);
                } else {
                  window.setTimeout(_.highlightAll, 16);
                }
              } else {
                document.addEventListener('DOMContentLoaded', _.highlightAll);
              }
            }
          }

          return _self.Prism;
        }();

        if (typeof module !== 'undefined' && module.exports) {
          module.exports = Prism;
        } // hack for components to work correctly in node.js


        if (typeof global !== 'undefined') {
          global.Prism = Prism;
        }
        /* **********************************************
             Begin prism-markup.js
        ********************************************** */


        Prism.languages.markup = {
          'comment': /<!--[\s\S]*?-->/,
          'prolog': /<\?[\s\S]+?\?>/,
          'doctype': /<!DOCTYPE[\s\S]+?>/i,
          'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
          'tag': {
            pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,
            greedy: true,
            inside: {
              'tag': {
                pattern: /^<\/?[^\s>\/]+/i,
                inside: {
                  'punctuation': /^<\/?/,
                  'namespace': /^[^\s>\/:]+:/
                }
              },
              'attr-value': {
                pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,
                inside: {
                  'punctuation': [/^=/, {
                    pattern: /(^|[^\\])["']/,
                    lookbehind: true
                  }]
                }
              },
              'punctuation': /\/?>/,
              'attr-name': {
                pattern: /[^\s>\/]+/,
                inside: {
                  'namespace': /^[^\s>\/:]+:/
                }
              }
            }
          },
          'entity': /&#?[\da-z]{1,8};/i
        };
        Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity']; // Plugin to make entity title show the real entity, idea by Roman Komarov

        Prism.hooks.add('wrap', function (env) {
          if (env.type === 'entity') {
            env.attributes['title'] = env.content.replace(/&amp;/, '&');
          }
        });
        Prism.languages.xml = Prism.languages.markup;
        Prism.languages.html = Prism.languages.markup;
        Prism.languages.mathml = Prism.languages.markup;
        Prism.languages.svg = Prism.languages.markup;
        /* **********************************************
             Begin prism-css.js
        ********************************************** */

        Prism.languages.css = {
          'comment': /\/\*[\s\S]*?\*\//,
          'atrule': {
            pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i,
            inside: {
              'rule': /@[\w-]+/ // See rest below

            }
          },
          'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
          'selector': /[^{}\s][^{};]*?(?=\s*\{)/,
          'string': {
            pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
            greedy: true
          },
          'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
          'important': /\B!important\b/i,
          'function': /[-a-z0-9]+(?=\()/i,
          'punctuation': /[(){};:]/
        };
        Prism.languages.css['atrule'].inside.rest = Prism.languages.css;

        if (Prism.languages.markup) {
          Prism.languages.insertBefore('markup', 'tag', {
            'style': {
              pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
              lookbehind: true,
              inside: Prism.languages.css,
              alias: 'language-css',
              greedy: true
            }
          });
          Prism.languages.insertBefore('inside', 'attr-value', {
            'style-attr': {
              pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
              inside: {
                'attr-name': {
                  pattern: /^\s*style/i,
                  inside: Prism.languages.markup.tag.inside
                },
                'punctuation': /^\s*=\s*['"]|['"]\s*$/,
                'attr-value': {
                  pattern: /.+/i,
                  inside: Prism.languages.css
                }
              },
              alias: 'language-css'
            }
          }, Prism.languages.markup.tag);
        }
        /* **********************************************
             Begin prism-clike.js
        ********************************************** */


        Prism.languages.clike = {
          'comment': [{
            pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
            lookbehind: true
          }, {
            pattern: /(^|[^\\:])\/\/.*/,
            lookbehind: true,
            greedy: true
          }],
          'string': {
            pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
            greedy: true
          },
          'class-name': {
            pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
            lookbehind: true,
            inside: {
              punctuation: /[.\\]/
            }
          },
          'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
          'boolean': /\b(?:true|false)\b/,
          'function': /[a-z0-9_]+(?=\()/i,
          'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
          'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
          'punctuation': /[{}[\];(),.:]/
        };
        /* **********************************************
             Begin prism-javascript.js
        ********************************************** */

        Prism.languages.javascript = Prism.languages.extend('clike', {
          'keyword': /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
          'number': /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
          // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
          'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,
          'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
        });
        Prism.languages.insertBefore('javascript', 'keyword', {
          'regex': {
            pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,
            lookbehind: true,
            greedy: true
          },
          // This must be declared before keyword because we use "function" inside the look-forward
          'function-variable': {
            pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,
            alias: 'function'
          },
          'constant': /\b[A-Z][A-Z\d_]*\b/
        });
        Prism.languages.insertBefore('javascript', 'string', {
          'template-string': {
            pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,
            greedy: true,
            inside: {
              'interpolation': {
                pattern: /\${[^}]+}/,
                inside: {
                  'interpolation-punctuation': {
                    pattern: /^\${|}$/,
                    alias: 'punctuation'
                  },
                  rest: null // See below

                }
              },
              'string': /[\s\S]+/
            }
          }
        });
        Prism.languages.javascript['template-string'].inside['interpolation'].inside.rest = Prism.languages.javascript;

        if (Prism.languages.markup) {
          Prism.languages.insertBefore('markup', 'tag', {
            'script': {
              pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
              lookbehind: true,
              inside: Prism.languages.javascript,
              alias: 'language-javascript',
              greedy: true
            }
          });
        }

        Prism.languages.js = Prism.languages.javascript;
        /* **********************************************
             Begin prism-file-highlight.js
        ********************************************** */

        (function () {
          if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {
            return;
          }

          self.Prism.fileHighlight = function () {
            var Extensions = {
              'js': 'javascript',
              'py': 'python',
              'rb': 'ruby',
              'ps1': 'powershell',
              'psm1': 'powershell',
              'sh': 'bash',
              'bat': 'batch',
              'h': 'c',
              'tex': 'latex'
            };
            Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) {
              var src = pre.getAttribute('data-src');
              var language,
                  parent = pre;
              var lang = /\blang(?:uage)?-([\w-]+)\b/i;

              while (parent && !lang.test(parent.className)) {
                parent = parent.parentNode;
              }

              if (parent) {
                language = (pre.className.match(lang) || [, ''])[1];
              }

              if (!language) {
                var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
                language = Extensions[extension] || extension;
              }

              var code = document.createElement('code');
              code.className = 'language-' + language;
              pre.textContent = '';
              code.textContent = 'Loading…';
              pre.appendChild(code);
              var xhr = new XMLHttpRequest();
              xhr.open('GET', src, true);

              xhr.onreadystatechange = function () {
                if (xhr.readyState == 4) {
                  if (xhr.status < 400 && xhr.responseText) {
                    code.textContent = xhr.responseText;
                    Prism.highlightElement(code);
                  } else if (xhr.status >= 400) {
                    code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
                  } else {
                    code.textContent = '✖ Error: File does not exist or is empty';
                  }
                }
              };

              xhr.send(null);
            });

            if (Prism.plugins.toolbar) {
              Prism.plugins.toolbar.registerButton('download-file', function (env) {
                var pre = env.element.parentNode;

                if (!pre || !/pre/i.test(pre.nodeName) || !pre.hasAttribute('data-src') || !pre.hasAttribute('data-download-link')) {
                  return;
                }

                var src = pre.getAttribute('data-src');
                var a = document.createElement('a');
                a.textContent = pre.getAttribute('data-download-link-label') || 'Download';
                a.setAttribute('download', '');
                a.href = src;
                return a;
              });
            }
          };

          document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight);
        })();
      }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
    }, {}],
    4: [function (require, module, exports) {
      "use strict";

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports.resume = "# \u9648\u5CF0\u78CA\n\n\u524D\u7AEF\u5F00\u53D1\u5DE5\u7A0B\u5E08\n\n# \u6280\u672F\n\n* html, css, js\n* jquery, bootstrap, vue\n\n# \u5DE5\u4F5C\u7ECF\u9A8C\n\n* \u4E0A\u6D77\u67D0\u516C\u53F8\n\n# \u9879\u76EE\u7ECF\u9A8C\n\n* [chenfl.top](http://chenfl.top/)\n\n# \u6211\u7684\u793E\u4EA4\u5708\n\n* [\u90AE\u7BB1](mailto:dreamcfl@163.com)\n* [CSDN](https://blog.csdn.net/namechenfl)\n* [\u7801\u4E91](https://gitee.com/cfl8)\n* [\u535A\u5BA2](http://chenfl.top/)\n";
    }, {}],
    5: [function (require, module, exports) {
      "use strict";

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var untils_1 = require("../scripts/animateResume/untils/untils");

      var is_mobile = untils_1.isMobile();
      exports.style1 = "/**\n *\n * \u563F\uFF0C\u6211\u7684\u540D\u5B57\u662F\u9648\u5CF0\u78CA\u3002\u6211\u662F\u4E00\u540D\u524D\u7AEF\u5F00\u53D1\u4EBA\u5458\u3002\n *\n * \u6211\u5EFA\u7ACB\u4E00\u4E2A\u52A8\u753B\u7B80\u5386\n *\n * \u8BA9\u6211\u4EEC\u5F00\u59CB\u3002\u6211\u4EEC\u4ECE\u52A8\u753B\u5F00\u59CB......\n * \u662F\u7684\uFF0C\u4E00\u5207\u3002\n */\n\n* {\n  transition: all 1s;\n}\n\n/**\n * \u4F3C\u4E4E\u6CE8\u610F\u5230\u4E86\u3002\u4F46\u4F60\u4F1A\u770B\u5230\u3002\n *\n * \u767D\u8272\u9ED1\u8272\u771F\u7684\u5F88\u65E0\u804A\uFF0C\n * \u9996\u5148\u6539\u53D8background\u3002\n */\n\nhtml {\n  background: #216583;\n  font-size: 10px;\n  overflow: hidden;\n}\n\n/***\n * \u7A0D\u7B49......\n */\n\npre, a {\n  color: #ffffff;\n}\n\n/**\n * \u90A3\u66F4\u597D\u3002\n *\n * \u5728\u8FD9\u4E2A\u5927\u7A7A\u95F4\u5DE5\u4F5C\u662F\u8270\u96BE\u7684\u3002\n *\n * \u6211\u6253\u7B97\u7528\u4E00\u4E2A\u5F88\u597D\u7684\u533A\u57DF\u6765\u5C55\u793A\u5185\u5BB9\u3002\n */\n\npre:not(:empty) {\n  ".concat(is_mobile ? "height:46%;\n  width: calc(100% - 2rem);" : "height: 100%;", "\n  font-size: 1.4rem;\n  overflow: auto;\n  background: rgb(48, 48, 48);\n  border: 1px solid #ccc;\n  padding: 1rem 1rem 2rem;\n  white-space: pre-wrap;\n  outline: 0;\n}\n\n#style-container {\n  height:92%;").concat(is_mobile ? 'width:100%;' : 'width: 49%;transform: translateX(95%);', "\n  position: absolute;\n  left: 1rem;\n  top: 1rem;\n}\n\n/**\n * \u8FD9\u5F88\u597D\uFF0C\u4F46\u6240\u6709\u6587\u5B57\u90FD\u662F\u767D\u8272\u7684\uFF01\n * \u8BA9\u5B83\u66F4\u5177\u53EF\u8BFB\u6027\u3002\n */\n\n#style-container  { color: #DEDEDE }\n.comment       { color: #857F6B; font-style: italic; }\n.selector      { color: #D7BA7D; }\n.keyword       { color: #569CD6; }\n.property      { color: #569CD6; }\n.function      { color: #C366A3; }\n.punctuation   { color: #FFCF00; }\n\n/**\n * \u73B0\u5728\u662F\u65F6\u5019\u4E86\u89E3\u4E00\u70B9\u3002\n */\n\nbody {\n  perspective: 100rem;\n}\n\n#style-container {\n  ").concat(is_mobile ? 'transform: rotateX(-10deg);' : 'transform: translateX(98.5%) rotateY(-10deg);', "\n  transform-origin: right;\n}\n\n/**\n * \u54E6\uFF0C\u662F\u65F6\u5019\u663E\u793A\u7B80\u5386\u4E86\u3002\n * \u4F60\u4E00\u5B9A\u4E0D\u80FD\u53EA\u770B\u5230\u6F02\u4EAE\u7684\u989C\u8272\u3002\n */\n\n #resume-container {\n  height:92%;").concat(is_mobile ? 'width:100%;' : 'width: 49%;', "\n  white-space: normal;\n ").concat(is_mobile ? " position: absolute;\n  left: 1rem;\n  top:50%;" : " position: absolute;\n  left: 1rem;\n  top: 1rem;\n  transform: rotateY(10deg);\n  transform-origin: left;", "\n}\n");
      exports.style2 = "/**\n * \u5DE6\u8FB9\u7684\u964D\u4EF7\u770B\u8D77\u6765\u4E0D\u592A\u597D\u3002\u8BA9\u6211\u4EEC\u6E32\u67D3\u5427\u3002\n */\n\n#resume-container{\n  font-size: 1.4rem;\n}\n#resume-container h1{\n  display: inline-block;\n  border-bottom: 1px solid;\n  margin: .5rem 0 1rem;\n  font-size: 2.6rem;\n}\n#resume-container a{\n  color: #ffffff;\n  text-decoration: none;\n}\n#resume-container ul> li{\n  margin-bottom: .3rem;\n}\n#resume-container ul> li::before{\n  content: '\u2022';\n  margin-right: .5rem;\n  color: '#ffffff';\n}\n\n/**\n * \u54E6\uFF0C\u8FD9\u51E0\u4E4E\u5DF2\u7ECF\u5B8C\u6210\u4E86\u3002\n *\n * \u6B64\u9875\u9762\u7684\u7075\u611F\u6765\u81EA\u522B\u4EBA\u5E76\u6709\u6539\u8FDB\uFF0C\u8FD9\u662F\u6211\u5728\u901B\u6398\u91D1\u65F6\u9047\u5230\u7684\u3002\n *\n * \u6211\u771F\u7684\u5F88\u60CA\u8BB6\uFF0C\u73B0\u5728\u6211\u53EF\u4EE5\u81EA\u5DF1\u7F16\u5199\u4EE3\u7801\u4E86\u3002\n *\n * \u5F53\u7136\uFF0C\u5927\u591A\u6570\u53E5\u5B50\u90FD\u6765\u81EA\u4E8E\u6B64\u3002\n *\n */";
    }, {
      "../scripts/animateResume/untils/untils": 8
    }],
    6: [function (require, module, exports) {
      "use strict";

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var untils_1 = require("./untils/untils");

      var mobileEndAnimate_1 = require("./untils/mobileEndAnimate");

      var Prism = require("prismjs");

      var marked = require("marked");

      var AnimateResume =
      /*#__PURE__*/
      function () {
        function AnimateResume(container, options) {
          _classCallCheck(this, AnimateResume);

          this.container = container;
          this.options = options;
          this.isSkip = false;
        }

        _createClass(AnimateResume, [{
          key: "load",
          value: function load(contents, fn) {
            var _this4 = this;

            if (contents.length) {
              this.loadItem(contents[0]).then(function () {
                return _this4.load(contents.slice(1), fn);
              }).catch(function () {
                return _this4.skipAnimate();
              });
            } else {
              if (untils_1.isMobile()) {
                mobileEndAnimate_1.default(this.options.mobileAnimate.styleID, this.options.mobileAnimate.resumeID);
              }

              fn && fn();
            }
          }
        }, {
          key: "loadItem",
          value: function loadItem(item) {
            var _this5 = this;

            return new Promise(function (resolve, reject) {
              var container = untils_1.createContainer(_this5.container, item.id);
              var num = 0;
              var sum = item.load.length;
              var originContent = item.rewrite ? '' : container.innerHTML;
              var interval = 16;
              var styleEl;

              if (item.type === 'css') {
                styleEl = untils_1.getStyleEl();
              }

              var startLoad = function startLoad() {
                setTimeout(function () {
                  num += 1;

                  if (num <= sum) {
                    var str = item.load.substr(0, num);
                    var code;

                    switch (item.type) {
                      case 'css':
                        untils_1.handleStyle(str, styleEl);
                        code = Prism.highlight(str, Prism.languages.css);
                        break;

                      case 'md':
                        code = marked(str);
                        break;
                    }

                    var nextInterval = untils_1.getInterval(str, interval);
                    container.scrollTop = 100000;
                    container.innerHTML = originContent + code;

                    if (_this5.isSkip) {
                      reject();
                    } else {
                      setTimeout(function () {
                        startLoad();
                      }, nextInterval);
                    }
                  } else {
                    return resolve();
                  }
                }, interval);
              };

              startLoad();
            });
          }
        }, {
          key: "skipAnimate",
          value: function skipAnimate() {
            var _this6 = this;

            this.options.content.forEach(function (item) {
              var container = untils_1.createContainer(_this6.container, item.id);

              switch (item.type) {
                case 'css':
                  _this6.skipStyle(item, container);

                  break;

                case 'md':
                  _this6.skipMd(item, container);

                  break;
              }
            });

            if (untils_1.isMobile()) {
              mobileEndAnimate_1.default(this.options.mobileAnimate.styleID, this.options.mobileAnimate.resumeID);
            }
          }
        }, {
          key: "skipStyle",
          value: function skipStyle(item, container) {
            var styleStr = item.load;
            var styleEl = untils_1.getStyleEl();
            var originContent = '';
            var code = Prism.highlight(styleStr, Prism.languages.css);

            if (!item.rewrite) {
              originContent = container.innerHTML;
            }

            styleEl.innerHTML = styleStr;
            container.innerHTML = originContent + code;
          }
        }, {
          key: "skipMd",
          value: function skipMd(item, container) {
            container.innerHTML = marked(item.load);
          }
        }, {
          key: "animate",
          value: function animate(fn) {
            this.load(this.options.content, fn);
          }
        }, {
          key: "skip",
          value: function skip() {
            this.isSkip = true;
          }
        }]);

        return AnimateResume;
      }();

      exports.default = AnimateResume;
    }, {
      "./untils/mobileEndAnimate": 7,
      "./untils/untils": 8,
      "marked": 2,
      "prismjs": 3
    }],
    7: [function (require, module, exports) {
      "use strict";

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var BScroll = require("better-scroll");

      function mobileEndAnimate(styleID, resumeID) {
        var body = document.querySelector('body');
        var styleContainer = document.querySelector("#".concat(styleID));
        var style = document.querySelector("#".concat(styleID, "-pre"));
        var mdContainer = document.querySelector("#".concat(resumeID));
        var md = document.querySelector("#".concat(resumeID, "-pre"));
        body.style.cssText = 'overflow:hidden';
        var css = {
          width: 'calc(100% - 2rem)',
          height: 'calc(100% - 4rem)',
          overflow: 'hidden',
          border: '1px solid #ccc',
          background: 'rgb(48, 48, 48)',
          position: 'absolute',
          left: '1rem'
        };
        var cssStr = Object.entries(css).map(function (v) {
          return v.join(':');
        }).join(';');
        styleContainer.style.cssText = cssStr;
        mdContainer.style.cssText = cssStr;
        styleContainer.style.top = '1rem';
        mdContainer.style.top = 'calc(100% + 1rem)';
        var preCss = {
          transition: 'all 0s',
          maxHeight: 'none',
          overflow: 'visible',
          position: 'static',
          width: '100%',
          border: 'none',
          height: 'auto'
        };
        var preCssStr = Object.entries(preCss).map(function (v) {
          return v.join(':');
        }).join(';');
        style.style.cssText = preCssStr;
        md.style.cssText = preCssStr;
        style.style.transform = 'rotateX(0deg)';
        md.style.paddingBottom = '10rem';
        setTimeout(function () {
          mdContainer.style.transition = 'transform .5s ease-out';
          styleContainer.style.transition = 'transform .5s ease-out';
          mdContainer.style.transform = 'translateY(calc(-100% - 4rem))';
          styleContainer.style.transform = 'translateY(calc(-100% - 1rem))';
        }, 500);
        var styleScroll = new BScroll(styleContainer, {
          pullUpLoad: {
            threshold: 20
          }
        });
        var mdScroll = new BScroll(mdContainer, {
          pullDownRefresh: {
            threshold: 20
          }
        });
        styleScroll.on('pullingUp', function () {
          mdContainer.style.transform = 'translateY(calc(-100% - 4rem))';
          styleContainer.style.transform = 'translateY(calc(-100% - 1rem))';
          styleScroll.finishPullUp();
        });
        mdScroll.on('pullingDown', function () {
          mdContainer.style.transform = 'translateY(0)';
          styleContainer.style.transform = 'translateY(0)';
          mdScroll.finishPullDown();
        });
      }

      exports.default = mobileEndAnimate;
    }, {
      "better-scroll": 1
    }],
    8: [function (require, module, exports) {
      "use strict";

      Object.defineProperty(exports, "__esModule", {
        value: true
      }); // 根据字符结束设置间隔时间

      function getInterval(str) {
        var interval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;
        if (/\D[\,]\s$/.test(str)) return interval * 20;
        if (/[^\/]\n\n$/.test(str)) return interval * 40;
        if (/[\.\?\!]\s$/.test(str)) return interval * 60;
        return 0;
      }

      exports.getInterval = getInterval; // css 写入 style

      function handleStyle(style, el) {
        el.innerHTML = style;
      }

      exports.handleStyle = handleStyle; // 新建并返回容器

      function createContainer(container, id) {
        if (container.querySelector("#".concat(id)) === null) {
          var el = document.createElement('div');
          el.id = id;
          var pre = document.createElement('pre');
          pre.id = "".concat(id, "-pre");
          el.append(pre);
          container.append(el);
        }

        return container.querySelector("#".concat(id, "-pre"));
      }

      exports.createContainer = createContainer; // 判断是否为移动设备

      function isMobile() {
        return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? true : false;
      }

      exports.isMobile = isMobile; // 设置并获取 style 标签

      function getStyleEl() {
        var newStyle = document.createElement('style');
        var head = document.querySelector('head');
        head.appendChild(newStyle);
        var allStyle = document.querySelectorAll('style');
        return allStyle[allStyle.length - 1];
      }

      exports.getStyleEl = getStyleEl;
    }, {}],
    9: [function (require, module, exports) {
      "use strict";

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var index_1 = require("./animateResume/index");

      var style_1 = require("../load/style");

      var resume_1 = require("../load/resume");

      var load1 = {
        load: style_1.style1,
        type: 'css',
        id: 'style-container',
        rewrite: true
      };
      var load2 = {
        load: resume_1.resume,
        type: 'md',
        id: 'resume-container',
        rewrite: true
      };
      var load3 = {
        load: style_1.style2,
        type: 'css',
        id: 'style-container',
        rewrite: false
      };
      var container = document.querySelector('.animate-container');
      var ar = new index_1.default(container, {
        content: [load1, load2, load3],
        mobileAnimate: {
          styleID: 'style-container',
          resumeID: 'resume-container'
        }
      });
      var skipBtn = document.querySelector('#skip-btn');
      skipBtn.addEventListener('click', function () {
        ar.skip();
        skipBtn.style.display = 'none';
      });
      ar.animate(function () {
        skipBtn.style.display = 'none';
      });
    }, {
      "../load/resume": 4,
      "../load/style": 5,
      "./animateResume/index": 6
    }]
  }, {}, [9])(9);
});